1. 07 Oct, 2019 13 commits
    • David Chase's avatar
      cmd/compile: suppress statement marks on interior of switch tree · 01ff213a
      David Chase authored
      The lines on nodes within the IF-tree generated for switch
      statements looks like control flow so the lines get marked
      as statement boundaries.  Except for the first/root comparison,
      explicitly disable the marks.
      
      Change-Id: I64b966ed8e427cdc6b816ff6b6a2eb754346edc7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/198738
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJeremy Faller <jeremy@golang.org>
      01ff213a
    • Matthew Dempsky's avatar
      cmd/compile: remove useless block-indirection in type switch · ab00f89c
      Matthew Dempsky authored
      Previously, when emitting type switches without an explicit "case nil"
      clause, we would emit:
      
          if x == nil { goto Lnil }
          ...
          Lnil: goto Ldefault
      
      But we can instead just emit:
      
          if x == nil { goto Ldefault }
      
      Doesn't pass toolstash-check; seems like it causes some harmless
      instruction scheduling changes.
      
      Change-Id: Ie233dda26756911e93a08b3db40407ba38694c62
      Reviewed-on: https://go-review.googlesource.com/c/go/+/199644
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ab00f89c
    • Ben Schwartz's avatar
      runtime: speed up receive on empty closed channel · e1446d9c
      Ben Schwartz authored
      Currently, nonblocking receive on an open channel is about
      700 times faster than nonblocking receive on a closed channel.
      This change makes closed channels equally fast.
      
      Fixes #32529
      
      relevant benchstat output:
      name                       old time/op    new time/op    delta
      MakeChan/Byte-40            140ns ± 4%     137ns ± 7%   -2.38%  (p=0.023 n=17+19)
      MakeChan/Int-40             174ns ± 5%     173ns ± 6%     ~     (p=0.437 n=18+19)
      MakeChan/Ptr-40             315ns ±15%     301ns ±15%     ~     (p=0.051 n=20+20)
      MakeChan/Struct/0-40        123ns ± 8%      99ns ±11%  -19.18%  (p=0.000 n=20+17)
      MakeChan/Struct/32-40       297ns ± 8%     241ns ±18%  -19.13%  (p=0.000 n=20+20)
      MakeChan/Struct/40-40       344ns ± 5%     273ns ±23%  -20.49%  (p=0.000 n=20+20)
      ChanNonblocking-40         0.32ns ± 2%    0.32ns ± 2%   -1.25%  (p=0.000 n=19+18)
      SelectUncontended-40       5.72ns ± 1%    5.71ns ± 2%     ~     (p=0.326 n=19+19)
      SelectSyncContended-40     10.9µs ±10%    10.6µs ± 3%   -2.77%  (p=0.009 n=20+16)
      SelectAsyncContended-40    1.00µs ± 0%    1.10µs ± 0%  +10.75%  (p=0.000 n=18+19)
      SelectNonblock-40          1.22ns ± 2%    1.21ns ± 4%     ~     (p=0.141 n=18+19)
      ChanUncontended-40          240ns ± 4%     233ns ± 4%   -2.82%  (p=0.000 n=20+20)
      ChanContended-40           86.7µs ± 0%    82.7µs ± 0%   -4.64%  (p=0.000 n=20+19)
      ChanSync-40                 294ns ± 7%     284ns ± 9%   -3.44%  (p=0.006 n=20+20)
      ChanSyncWork-40            38.4µs ±19%    34.0µs ± 4%  -11.33%  (p=0.000 n=20+18)
      ChanProdCons0-40           1.50µs ± 1%    1.63µs ± 0%   +8.53%  (p=0.000 n=19+19)
      ChanProdCons10-40          1.17µs ± 0%    1.18µs ± 1%   +0.44%  (p=0.000 n=19+20)
      ChanProdCons100-40          985ns ± 0%     959ns ± 1%   -2.64%  (p=0.000 n=20+20)
      ChanProdConsWork0-40       1.50µs ± 0%    1.60µs ± 2%   +6.54%  (p=0.000 n=18+20)
      ChanProdConsWork10-40      1.26µs ± 0%    1.26µs ± 2%   +0.40%  (p=0.015 n=20+19)
      ChanProdConsWork100-40     1.27µs ± 0%    1.22µs ± 0%   -4.15%  (p=0.000 n=20+19)
      SelectProdCons-40          1.50µs ± 1%    1.53µs ± 1%   +1.95%  (p=0.000 n=20+20)
      ChanCreation-40            82.1ns ± 5%    81.6ns ± 7%     ~     (p=0.483 n=19+19)
      ChanSem-40                  877ns ± 0%     719ns ± 0%  -17.98%  (p=0.000 n=18+19)
      ChanPopular-40             1.75ms ± 2%    1.78ms ± 3%   +1.76%  (p=0.002 n=20+19)
      ChanClosed-40               215ns ± 1%       0ns ± 6%  -99.82%  (p=0.000 n=20+18)
      
      Change-Id: I6d5ca4f1530cc9e1a9f3ef553bbda3504a036448
      Reviewed-on: https://go-review.googlesource.com/c/go/+/181543
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      e1446d9c
    • Matthew Dempsky's avatar
      cmd/compile: reimplement parameter leak encoding · a0894ea5
      Matthew Dempsky authored
      Currently, escape analysis is able to record at most one dereference
      when a parameter leaks to the heap; that is, at call sites, it can't
      distinguish between any of these three functions:
      
          func x1(p ****int) { sink = *p }
          func x2(p ****int) { sink = **p }
          func x3(p ****int) { sink = ***p }
      
      Similarly, it's limited to recording parameter leaks to only the first
      4 parameters, and only up to 6 dereferences.
      
      All of these limitations are due to the awkward encoding scheme used
      at the moment.
      
      This CL replaces the encoding scheme with a simple [8]uint8 array,
      which can handle up to the first 7 parameters, and up to 254
      dereferences, which ought to be enough for anyone. And if not, it's
      much more easily increased.
      
      Shrinks export data size geometric mean for Kubernetes by 0.07%.
      
      Fixes #33981.
      
      Change-Id: I10a94b9accac9a0c91490e0d6d458316f5ca1e13
      Reviewed-on: https://go-review.googlesource.com/c/go/+/197680Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      a0894ea5
    • Matthew Dempsky's avatar
      cmd/compile: introduce EscLeaks abstraction · 05a805a6
      Matthew Dempsky authored
      This CL better abstracts away the parameter leak info that was
      directly encoded into the uint16 value. Followup CL will rewrite the
      implementation.
      
      Passes toolstash-check.
      
      Updates #33981.
      
      Change-Id: I27f81d26f5dd2d85f5b0e5250ca529819a1f11c2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/197679
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      05a805a6
    • Richard Musiol's avatar
      runtime: do not omit stack trace of goroutine that handles async events · 1c8e6077
      Richard Musiol authored
      On wasm there is a special goroutine that handles asynchronous events.
      Blocking this goroutine often causes a deadlock. However, the stack
      trace of this goroutine was omitted when printing the deadlock error.
      
      This change adds an exception so the goroutine is not considered as
      an internal system goroutine and the stack trace gets printed, which
      helps with debugging the deadlock.
      
      Updates #32764
      
      Change-Id: Icc8f5ba3ca5a485d557b7bdd76bf2f1ffb92eb3e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/199537
      Run-TryBot: Richard Musiol <neelance@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      1c8e6077
    • Richard Musiol's avatar
      cmd/link: produce valid binaries with large data section on wasm · 30521d51
      Richard Musiol authored
      CL 170950 had a regression that makes the compiler produce
      an invalid wasm binary if the data section is too large.
      Loading such a binary gives the following error:
      "LinkError: WebAssembly.instantiate(): data segment is out of bounds"
      
      This change fixes the issue by ensuring that the minimum size of the
      linear memory is larger than the end of the data section.
      
      Fixes #34395.
      
      Change-Id: I0c8629de7ffd0d85895ad31bf8c9d45fef197a57
      Reviewed-on: https://go-review.googlesource.com/c/go/+/199358Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      30521d51
    • Keith Randall's avatar
      cmd/compile: improve write barrier removal · 30da79d9
      Keith Randall authored
      We're allowed to remove a write barrier when both the old
      value in memory and the new value we're writing are not heap pointers.
      
      Improve both those checks a little bit.
      
      A pointer is known to not be a heap pointer if it is read from
      read-only memory. This sometimes happens for loads of pointers
      from string constants in read-only memory.
      
      Do a better job of tracking which parts of memory are known to be
      zero.  Before we just kept track of a range of offsets in the most
      recently allocated object. For code that initializes the new object's
      fields in a nonstandard order, that tracking is imprecise. Instead,
      keep a bit map of the first 64 words of that object, so we can track
      precisely what we know to be zeroed.
      
      The new scheme is only precise up to the first 512 bytes of the object.
      After that, we'll use write barriers unnecessarily. Hopefully most
      initializers of large objects will use typedmemmove, which does only one
      write barrier check for the whole initialization.
      
      Fixes #34723
      Update #21561
      
      Change-Id: Idf6e1b7d525042fb67961302d4fc6f941393cac8
      Reviewed-on: https://go-review.googlesource.com/c/go/+/199558
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      30da79d9
    • Cuong Manh Le's avatar
      internal/reflectlite: add missing copyright header · 54001652
      Cuong Manh Le authored
      Change-Id: Id43870de6608ef2e8c0ebef82fd710b2c3061e66
      Reviewed-on: https://go-review.googlesource.com/c/go/+/199599Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarTobias Klauser <tobias.klauser@gmail.com>
      54001652
    • Keith Randall's avatar
      cmd/compile: reuse dead register before reusing register holding constant · 72dc9ab1
      Keith Randall authored
      For commuting ops, check whether the second argument is dead before
      checking if the first argument is rematerializeable. Reusing the register
      holding a dead value is always best.
      
      Fixes #33580
      
      Change-Id: I7372cfc03d514e6774d2d9cc727a3e6bf6ce2657
      Reviewed-on: https://go-review.googlesource.com/c/go/+/199559
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      72dc9ab1
    • Meng Zhuo's avatar
      bytes: add endian base compare test · fc2915fa
      Meng Zhuo authored
      The current bytes test suit didn't come with endian based test
      which causing #34549 can passed the try-bot.
      This test will failed when little endian architecture simply using
      load and compare uint.
      
      Update #34549
      
      Change-Id: I0973c2cd505ce21c2bed1deeb7d526f1e872118d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/198358Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fc2915fa
    • Cuong Manh Le's avatar
      internal/reflectlite: add type mirror with reflect test · 8b391060
      Cuong Manh Le authored
      Add test to check that struct type in reflectlite is mirror of reflect.
      Note that the test does not check the field types, only check for number
      of fields and field name are the same.
      
      Updates #34486
      
      Change-Id: Id5f9b26d35faec97863dd1fe7e5eab37d4913181
      Reviewed-on: https://go-review.googlesource.com/c/go/+/199280
      Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      8b391060
    • Michael Munday's avatar
      cmd/compile: reduce amount of code generated for block rewrite rules · c7d81bc0
      Michael Munday authored
      Add a Reset method to blocks that allows us to reduce the amount of
      code we generate for block rewrite rules.
      
      Thanks to Cherry for suggesting a similar fix to this in CL 196557.
      
      Compilebench result:
      
      name                      old time/op       new time/op       delta
      Template                        211ms ± 1%        211ms ± 1%   -0.30%  (p=0.028 n=19+20)
      Unicode                        83.7ms ± 3%       83.0ms ± 2%   -0.79%  (p=0.029 n=18+19)
      GoTypes                         757ms ± 1%        755ms ± 1%   -0.31%  (p=0.034 n=19+19)
      Compiler                        3.51s ± 1%        3.50s ± 1%   -0.20%  (p=0.013 n=18+18)
      SSA                             11.7s ± 1%        11.7s ± 1%   -0.38%  (p=0.000 n=19+19)
      Flate                           131ms ± 1%        130ms ± 1%   -0.32%  (p=0.024 n=18+18)
      GoParser                        162ms ± 1%        162ms ± 1%     ~     (p=0.059 n=20+18)
      Reflect                         471ms ± 0%        470ms ± 0%   -0.24%  (p=0.045 n=20+17)
      Tar                             187ms ± 1%        186ms ± 1%     ~     (p=0.157 n=20+20)
      XML                             255ms ± 1%        255ms ± 1%     ~     (p=0.461 n=19+20)
      LinkCompiler                    754ms ± 2%        755ms ± 2%     ~     (p=0.919 n=17+17)
      ExternalLinkCompiler            2.82s ±16%        2.37s ±10%  -15.94%  (p=0.000 n=20+20)
      LinkWithoutDebugCompiler        439ms ± 4%        442ms ± 6%     ~     (p=0.461 n=18+19)
      StdCmd                          25.8s ± 2%        25.5s ± 1%   -0.95%  (p=0.000 n=20+20)
      
      name                      old user-time/op  new user-time/op  delta
      Template                        240ms ± 8%        238ms ± 7%     ~     (p=0.301 n=20+20)
      Unicode                         107ms ±18%        104ms ±13%     ~     (p=0.149 n=20+20)
      GoTypes                         883ms ± 3%        888ms ± 2%     ~     (p=0.211 n=20+20)
      Compiler                        4.22s ± 1%        4.20s ± 1%     ~     (p=0.077 n=20+18)
      SSA                             14.1s ± 1%        14.1s ± 2%     ~     (p=0.192 n=20+20)
      Flate                           145ms ±10%        148ms ± 5%     ~     (p=0.126 n=20+18)
      GoParser                        186ms ± 7%        186ms ± 7%     ~     (p=0.779 n=20+20)
      Reflect                         538ms ± 3%        541ms ± 3%     ~     (p=0.192 n=20+20)
      Tar                             218ms ± 4%        217ms ± 6%     ~     (p=0.835 n=19+20)
      XML                             298ms ± 5%        298ms ± 5%     ~     (p=0.749 n=19+20)
      LinkCompiler                    818ms ± 5%        825ms ± 8%     ~     (p=0.461 n=20+20)
      ExternalLinkCompiler            1.55s ± 4%        1.53s ± 5%     ~     (p=0.063 n=20+18)
      LinkWithoutDebugCompiler        460ms ±12%        460ms ± 7%     ~     (p=0.925 n=20+20)
      
      name                      old object-bytes  new object-bytes  delta
      Template                        554kB ± 0%        554kB ± 0%     ~     (all equal)
      Unicode                         215kB ± 0%        215kB ± 0%     ~     (all equal)
      GoTypes                        2.01MB ± 0%       2.01MB ± 0%     ~     (all equal)
      Compiler                       7.97MB ± 0%       7.97MB ± 0%   +0.00%  (p=0.000 n=20+20)
      SSA                            26.8MB ± 0%       26.9MB ± 0%   +0.27%  (p=0.000 n=20+20)
      Flate                           340kB ± 0%        340kB ± 0%     ~     (all equal)
      GoParser                        434kB ± 0%        434kB ± 0%     ~     (all equal)
      Reflect                        1.34MB ± 0%       1.34MB ± 0%     ~     (all equal)
      Tar                             480kB ± 0%        480kB ± 0%     ~     (all equal)
      XML                             622kB ± 0%        622kB ± 0%     ~     (all equal)
      
      name                      old export-bytes  new export-bytes  delta
      Template                       20.4kB ± 0%       20.4kB ± 0%     ~     (all equal)
      Unicode                        8.21kB ± 0%       8.21kB ± 0%     ~     (all equal)
      GoTypes                        36.6kB ± 0%       36.6kB ± 0%     ~     (all equal)
      Compiler                        115kB ± 0%        115kB ± 0%   +0.08%  (p=0.000 n=20+20)
      SSA                             141kB ± 0%        141kB ± 0%   +0.07%  (p=0.000 n=20+20)
      Flate                          5.11kB ± 0%       5.11kB ± 0%     ~     (all equal)
      GoParser                       8.93kB ± 0%       8.93kB ± 0%     ~     (all equal)
      Reflect                        11.8kB ± 0%       11.8kB ± 0%     ~     (all equal)
      Tar                            10.9kB ± 0%       10.9kB ± 0%     ~     (all equal)
      XML                            17.4kB ± 0%       17.4kB ± 0%     ~     (all equal)
      
      name                      old text-bytes    new text-bytes    delta
      HelloSize                       742kB ± 0%        742kB ± 0%     ~     (all equal)
      CmdGoSize                      10.7MB ± 0%       10.7MB ± 0%     ~     (all equal)
      
      name                      old data-bytes    new data-bytes    delta
      HelloSize                      10.7kB ± 0%       10.7kB ± 0%     ~     (all equal)
      CmdGoSize                       312kB ± 0%        312kB ± 0%     ~     (all equal)
      
      name                      old bss-bytes     new bss-bytes     delta
      HelloSize                       122kB ± 0%        122kB ± 0%     ~     (all equal)
      CmdGoSize                       146kB ± 0%        146kB ± 0%     ~     (all equal)
      
      name                      old exe-bytes     new exe-bytes     delta
      HelloSize                      1.10MB ± 0%       1.10MB ± 0%     ~     (all equal)
      CmdGoSize                      14.9MB ± 0%       14.9MB ± 0%     ~     (all equal)
      
      Change-Id: Ic89a8e62423b3d9fd9391159e0663acf450803b5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/198419
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      c7d81bc0
  2. 06 Oct, 2019 2 commits
  3. 05 Oct, 2019 7 commits
  4. 04 Oct, 2019 18 commits