1. 17 Mar, 2017 22 commits
  2. 16 Mar, 2017 15 commits
    • Jeremy Jackins's avatar
      cmd/compile: further clarify assignment count mismatch error message · 73a44f04
      Jeremy Jackins authored
      This is an evolution of https://go-review.googlesource.com/33616, as discussed
      via email with Robert (gri):
      
      $ cat foobar.go
      package main
      
      func main() {
              a := "foo", "bar"
      }
      
      before:
      ./foobar.go:4:4: assignment count mismatch: want 1 values, got 2
      
      after:
      ./foobar.go:4:4: assignment count mismatch: cannot assign 2 values to 1 variables
      
      We could likely also eliminate the "assignment count mismatch" prefix now
      without losing any information, but that string is matched by a number of
      tests.
      
      Change-Id: Ie6fc8a7bbd0ebe841d53e66e5c2f49868decf761
      Reviewed-on: https://go-review.googlesource.com/38313Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      73a44f04
    • Keith Randall's avatar
      cmd/compile: intrinsics for math/bits.{Len,LeadingZeros} · 495b1679
      Keith Randall authored
      name              old time/op  new time/op  delta
      LeadingZeros-4    2.00ns ± 0%  1.34ns ± 1%  -33.02%  (p=0.000 n=8+10)
      LeadingZeros16-4  1.62ns ± 0%  1.57ns ± 0%   -3.09%  (p=0.001 n=8+9)
      LeadingZeros32-4  2.14ns ± 0%  1.48ns ± 0%  -30.84%  (p=0.002 n=8+10)
      LeadingZeros64-4  2.06ns ± 1%  1.33ns ± 0%  -35.08%  (p=0.000 n=8+8)
      
      8-bit args is a special case - the Go code is really fast because
      it is just a single table lookup.  So I've disabled that for now.
      Intrinsics were actually slower:
      LeadingZeros8-4   1.22ns ± 3%  1.58ns ± 1%  +29.56%  (p=0.000 n=10+10)
      
      Update #18616
      
      Change-Id: Ia9c289b9ba59c583ea64060470315fd637e814cf
      Reviewed-on: https://go-review.googlesource.com/38311
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      495b1679
    • Steve Francia's avatar
      doc: reorganize the contribution guidelines into a guide · 5f3e7aa7
      Steve Francia authored
      Updates #17802
      
      Change-Id: I65ea0f4cde973604c04051e7eb25d12e4facecd3
      Reviewed-on: https://go-review.googlesource.com/36626Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarChris Broadfoot <cbro@golang.org>
      5f3e7aa7
    • Aliaksandr Valialkin's avatar
      strconv: optimize formatting for small decimal ints · bc8b9b23
      Aliaksandr Valialkin authored
      Avoid memory allocations by returning pre-calculated strings
      for decimal ints in the range 0..99.
      
      Benchmark results:
      
      name              old time/op    new time/op    delta
      FormatInt-4         2.45µs ± 1%    2.40µs ± 1%    -1.86%  (p=0.000 n=8+9)
      AppendInt-4         1.67µs ± 1%    1.65µs ± 0%    -0.92%  (p=0.000 n=10+10)
      FormatUint-4         676ns ± 3%     669ns ± 1%      ~     (p=0.146 n=10+10)
      AppendUint-4         467ns ± 2%     474ns ± 0%    +1.58%  (p=0.000 n=10+10)
      FormatIntSmall-4    29.6ns ± 2%     3.3ns ± 0%   -88.98%  (p=0.000 n=10+9)
      AppendIntSmall-4    16.0ns ± 1%     8.5ns ± 0%   -46.98%  (p=0.000 n=10+9)
      
      name              old alloc/op   new alloc/op   delta
      FormatInt-4           576B ± 0%      576B ± 0%      ~     (all equal)
      AppendInt-4          0.00B          0.00B           ~     (all equal)
      FormatUint-4          224B ± 0%      224B ± 0%      ~     (all equal)
      AppendUint-4         0.00B          0.00B           ~     (all equal)
      FormatIntSmall-4     2.00B ± 0%     0.00B       -100.00%  (p=0.000 n=10+10)
      AppendIntSmall-4     0.00B          0.00B           ~     (all equal)
      
      name              old allocs/op  new allocs/op  delta
      FormatInt-4           37.0 ± 0%      35.0 ± 0%    -5.41%  (p=0.000 n=10+10)
      AppendInt-4           0.00           0.00           ~     (all equal)
      FormatUint-4          6.00 ± 0%      6.00 ± 0%      ~     (all equal)
      AppendUint-4          0.00           0.00           ~     (all equal)
      FormatIntSmall-4      1.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
      AppendIntSmall-4      0.00           0.00           ~     (all equal)
      
      Fixes #19445
      
      Change-Id: Ib1f8922f2e0b13743c847ee9e703d1dab77f705c
      Reviewed-on: https://go-review.googlesource.com/37963Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      bc8b9b23
    • Keith Randall's avatar
      cmd/compile: intrinsify math/bits.ReverseBytes · dd9892e3
      Keith Randall authored
      Update #18616
      
      Change-Id: I0c2d643cbbeb131b4c9b12194697afa4af48e1d2
      Reviewed-on: https://go-review.googlesource.com/38166
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      dd9892e3
    • Cherry Zhang's avatar
      cmd/compile: fix MIPS Zero lower rule · 793e4ec3
      Cherry Zhang authored
      A copy-paste error in CL 38150. Fix build.
      
      Change-Id: Ib2afc83564ebe7dab934d45522803e1a191dea18
      Reviewed-on: https://go-review.googlesource.com/38292
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      793e4ec3
    • Matthew Dempsky's avatar
      cmd/compile/internal/syntax: track column position at function end · f37ee0f3
      Matthew Dempsky authored
      Fixes #19576.
      
      Change-Id: I11034fb08e989f6eb7d54bde873b92804223598d
      Reviewed-on: https://go-review.googlesource.com/38291
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f37ee0f3
    • Cherry Zhang's avatar
      cmd/compile: use type information in Aux for Store size · c8f38b33
      Cherry Zhang authored
      Remove size AuxInt in Store, and alignment in Move/Zero. We still
      pass size AuxInt to Move/Zero, as it is used for partial Move/Zero
      lowering (e.g. cmd/compile/internal/ssa/gen/386.rules:288).
      SizeAndAlign is gone.
      
      Passes "toolstash -cmp" on std.
      
      Change-Id: I1ca34652b65dd30de886940e789fcf41d521475d
      Reviewed-on: https://go-review.googlesource.com/38150
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      c8f38b33
    • Cherry Zhang's avatar
      cmd/compile: add a test for writebarrier pass with single-block loop · d75925d6
      Cherry Zhang authored
      The old writebarrier implementation fails to handle single-block
      loop where a memory Phi value depends on the write barrier store
      in the same block. The new implementation (CL 36834) doesn't have
      this problem. Add a test to ensure it.
      
      Fix #19067.
      
      Change-Id: Iab13c6817edc12be8a048d18699b4450fa7ed712
      Reviewed-on: https://go-review.googlesource.com/36940Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      d75925d6
    • Cherry Zhang's avatar
      cmd/compile: clean up SSA-building code · 1b853006
      Cherry Zhang authored
      Now that the write barrier insertion is moved to SSA, the SSA
      building code can be simplified.
      
      Updates #17583.
      
      Change-Id: I5cacc034b11aa90b0abe6f8dd97e4e3994e2bc25
      Reviewed-on: https://go-review.googlesource.com/36840
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      1b853006
    • Cherry Zhang's avatar
      cmd/compile: move write barrier insertion to SSA · 9ebf3d51
      Cherry Zhang authored
      When the compiler insert write barriers, the frontend makes
      conservative decisions at an early stage. This sometimes have
      false positives because of the lack of information, for example,
      writes on stack. SSA's writebarrier pass identifies writes on
      stack and eliminates write barriers for them.
      
      This CL moves write barrier insertion into SSA. The frontend no
      longer makes decisions about write barriers, and simply does
      normal assignments and emits normal Store ops when building SSA.
      SSA writebarrier pass inserts write barrier for Stores when needed.
      There, it has better information about the store because Phi and
      Copy propagation are done at that time.
      
      This CL only changes StoreWB to Store in gc/ssa.go. A followup CL
      simplifies SSA building code.
      
      Updates #17583.
      
      Change-Id: I4592d9bc0067503befc169c50b4e6f4765673bec
      Reviewed-on: https://go-review.googlesource.com/36839
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      9ebf3d51
    • Cherry Zhang's avatar
      cmd/compile: pass types on SSA Store/Move/Zero ops · 211c8c9f
      Cherry Zhang authored
      For SSA Store/Move/Zero ops, attach the type of the value being
      stored to the op as the Aux field. This type will be used for
      write barrier insertion (in a followup CL). Since SSA passes
      do not accurately propagate types of values (because of type
      casting), we can't simply use type of the store's arguments
      for write barrier insertion.
      
      Passes "toolstash -cmp" on std.
      
      Updates #17583.
      
      Change-Id: I051d5e5c482931640d1d7d879b2a6bb91f2e0056
      Reviewed-on: https://go-review.googlesource.com/36838
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      211c8c9f
    • Daniel Martí's avatar
      runtime: remove unused g parameter · 77b09b8b
      Daniel Martí authored
      Found by github.com/mvdan/unparam.
      
      Change-Id: I20145440ff1bcd27fcf15a740354c52f313e536c
      Reviewed-on: https://go-review.googlesource.com/37894
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      77b09b8b
    • Carlos Eduardo Seo's avatar
      runtime: improve IndexByte for ppc64x · d60166d5
      Carlos Eduardo Seo authored
      This change adds a better implementation of IndexByte for ppc64x.
      
      Improvement for bytes·IndexByte:
      
      benchmark                             old ns/op     new ns/op     delta
      BenchmarkIndexByte/10-16              12.5          8.48          -32.16%
      BenchmarkIndexByte/32-16              34.4          9.85          -71.37%
      BenchmarkIndexByte/4K-16              3089          217           -92.98%
      BenchmarkIndexByte/4M-16              3154810       207051        -93.44%
      BenchmarkIndexByte/64M-16             50564811      5579093       -88.97%
      
      benchmark                             old MB/s     new MB/s     speedup
      BenchmarkIndexByte/10-16              800.41       1179.64      1.47x
      BenchmarkIndexByte/32-16              930.60       3249.10      3.49x
      BenchmarkIndexByte/4K-16              1325.71      18832.53     14.21x
      BenchmarkIndexByte/4M-16              1329.49      20257.29     15.24x
      BenchmarkIndexByte/64M-16             1327.19      12028.63     9.06x
      
      Improvement for strings·IndexByte:
      
      benchmark                             old ns/op     new ns/op     delta
      BenchmarkIndexByte-16                 25.9          7.69          -70.31%
      
      Fixes #19030
      
      Change-Id: Ifb82bbb3d643ec44b98eaa2d08a07f47e5c2fd11
      Reviewed-on: https://go-review.googlesource.com/37670
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarLynn Boger <laboger@linux.vnet.ibm.com>
      d60166d5
    • Keith Randall's avatar
      cmd/compile: intrinsics for math/bits.TrailingZerosX · d5dc4905
      Keith Randall authored
      Implement math/bits.TrailingZerosX using intrinsics.
      
      Generally reorganize the intrinsic spec a bit.
      The instrinsics data structure is now built at init time.
      This will make doing the other functions in math/bits easier.
      
      Update sys.CtzX to return int instead of uint{64,32} so it
      matches math/bits.TrailingZerosX.
      
      Improve the intrinsics a bit for amd64.  We don't need the CMOV
      for <64 bit versions.
      
      Update #18616
      
      Change-Id: Ic1c5339c943f961d830ae56f12674d7b29d4ff39
      Reviewed-on: https://go-review.googlesource.com/38155
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      d5dc4905
  3. 15 Mar, 2017 3 commits
    • Martin Möhrmann's avatar
      runtime: make complex division c99 compatible · 16200c73
      Martin Möhrmann authored
      - changes tests to check that the real and imaginary part of the go complex
        division result is equal to the result gcc produces for c99
      - changes complex division code to satisfy new complex division test
      - adds float functions isNan, isFinite, isInf, abs and copysign
        in the runtime package
      
      Fixes #14644.
      
      name                   old time/op  new time/op  delta
      Complex128DivNormal-4  21.8ns ± 6%  13.9ns ± 6%  -36.37%  (p=0.000 n=20+20)
      Complex128DivNisNaN-4  14.1ns ± 1%  15.0ns ± 1%   +5.86%  (p=0.000 n=20+19)
      Complex128DivDisNaN-4  12.5ns ± 1%  16.7ns ± 1%  +33.79%  (p=0.000 n=19+20)
      Complex128DivNisInf-4  10.1ns ± 1%  13.0ns ± 1%  +28.25%  (p=0.000 n=20+19)
      Complex128DivDisInf-4  11.0ns ± 1%  20.9ns ± 1%  +90.69%  (p=0.000 n=16+19)
      ComplexAlgMap-4        86.7ns ± 1%  86.8ns ± 2%     ~     (p=0.804 n=20+20)
      
      Change-Id: I261f3b4a81f6cc858bc7ff48f6fd1b39c300abf0
      Reviewed-on: https://go-review.googlesource.com/37441Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      16200c73
    • Austin Clements's avatar
      runtime: print user stack on other threads during GOTRACBEACK=crash · 4b8f41da
      Austin Clements authored
      Currently, when printing tracebacks of other threads during
      GOTRACEBACK=crash, if the thread is on the system stack we print only
      the header for the user goroutine and fail to print its stack. This
      happens because we passed the g0 to traceback instead of curg. The g0
      never has anything set in its gobuf, so traceback doesn't print
      anything.
      
      Fix this by passing _g_.m.curg to traceback instead of the g0.
      
      Fixes #19494.
      
      Change-Id: Idfabf94d6a725e9cdf94a3923dead6455ef3b217
      Reviewed-on: https://go-review.googlesource.com/38012
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      4b8f41da
    • Austin Clements's avatar
      runtime: make GOTRACEBACK=crash crash promptly in cgo binaries · f2e87158
      Austin Clements authored
      GOTRACEBACK=crash works by bouncing a SIGQUIT around the process
      sched.mcount times. However, sched.mcount includes the extra Ms
      allocated by oneNewExtraM for cgo callbacks. Hence, if there are any
      extra Ms that don't have real OS threads, we'll try to send SIGQUIT
      more times than there are threads to catch it. Since nothing will
      catch these extra signals, we'll fall back to blocking for five
      seconds before aborting the process.
      
      Avoid this five second delay by subtracting out the number of extra Ms
      when sending SIGQUITs.
      
      Of course, in a cgo binary, it's still possible for the SIGQUIT to go
      to a cgo thread and cause some other failure mode. This does not fix
      that.
      
      Change-Id: I4fbf3c52dd721812796c4c1dcb2ab4cb7026d965
      Reviewed-on: https://go-review.googlesource.com/38182
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      f2e87158