1. 15 Aug, 2017 27 commits
  2. 14 Aug, 2017 13 commits
    • Keith Randall's avatar
      cmd/link,compile: Provide size for func types · f4abbc0e
      Keith Randall authored
      They are currently not given a size, which makes the DWARF reader
      very confused. Particularly things like [4]func() get a size of -4, not 32.
      
      Fixes #21097
      
      Change-Id: I01e754134d82fbbe6567e3c7847a4843792a3776
      Reviewed-on: https://go-review.googlesource.com/55551Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f4abbc0e
    • Josh Bleecher Snyder's avatar
      runtime: refactor evacuate x/y handling · 77a9cb9b
      Josh Bleecher Snyder authored
      This change unifies the x and y cases.
      
      It shrinks evacuate's machine code by ~25% and its stack size by ~15%.
      
      It also eliminates a critical branch.
      Whether an entry should go to x or y is designed to be unpredictable.
      As a result, half of the branch predictions for useX were wrong.
      Mispredicting that branch can easily incur an expensive cache miss.
      Switching to an xy array allows elimination of that branch,
      which in turn reduces cache misses.
      
      Change-Id: Ie9cef53744b96c724c377ac0985b487fc50b49b1
      Reviewed-on: https://go-review.googlesource.com/54653
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      77a9cb9b
    • Josh Bleecher Snyder's avatar
      runtime: calculate k only once in mapiternext · 589fc314
      Josh Bleecher Snyder authored
      Make the calculation of k and v a bit lazier.
      None of the following code cares about indirect-vs-direct k,
      and it happens on all code paths, so check t.indirectkey earlier.
      
      Simplifies the code and reduces both machine code and stack size.
      
      Change-Id: I5ea4c0772848d7a4b15383baedb9a1f7feb47201
      Reviewed-on: https://go-review.googlesource.com/55092
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      589fc314
    • Josh Bleecher Snyder's avatar
      runtime: special case allocation of arrays of size 1 · 29e9b89b
      Josh Bleecher Snyder authored
      This avoids division and multiplication.
      Instrumentation suggests that this is a very common case.
      
      Change-Id: I2d5d5012d4f4df4c4af1f9f85ca9c323c9889c0e
      Reviewed-on: https://go-review.googlesource.com/54657
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      29e9b89b
    • Josh Bleecher Snyder's avatar
      runtime: use integer math for hashmap overLoadFactor · 733567a1
      Josh Bleecher Snyder authored
      Change-Id: I92cf39a05e738a03d956779d7a1ab1ef8074b2ab
      Reviewed-on: https://go-review.googlesource.com/54655
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      733567a1
    • Joe Tsai's avatar
      archive/tar: remove writeHeader and writePAXHeaderLegacy · 694875cb
      Joe Tsai authored
      Previous CLs (CL/54970, CL55231, and CL/55237) re-implemented tar.Writer
      entirely using specialized methods (writeUSTARHeader, writePAXHeader,
      and writeGNUHeader) allowing tar.Writer to entirely side-step the broken
      and buggy logic in writeHeader.
      
      Since writeHeader and writePAXHeaderLegacy is now dead-code,
      we can delete them.
      
      One minor change is that we call Writer.Flush at the start of WriteHeader.
      This used to be performed by writeHeader, but doing so in WriteHeader
      ensures each of the specialized methods can benefit from its effect.
      
      Fixes #17665
      Fixes #12594
      
      Change-Id: Iff2ef8e7310d40ac5484d2f8852fc5df25201426
      Reviewed-on: https://go-review.googlesource.com/55550Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      694875cb
    • Joe Tsai's avatar
      archive/tar: implement specialized logic for GNU format · ffd9810e
      Joe Tsai authored
      Rather than going through writeHeader, which attempts to handle all formats,
      implement writeGNUHeader, which only has an understanding of the GNU format.
      
      Currently, the implementation is nearly identical to writeUSTARHeader, except:
      * formatNumeric is used instead of formatOctal
      * the GNU magic value is used
      
      This is kept as a separate method since it makes more logical sense
      when we add support for sparse files, long filenames, and atime/ctime fields,
      which do not affect USTAR.
      
      Updates #12594
      
      Change-Id: I76efc0b39dc649efc22646dfc9867a7c165f34a8
      Reviewed-on: https://go-review.googlesource.com/55237
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMartin Möhrmann <moehrmann@google.com>
      ffd9810e
    • Martin Möhrmann's avatar
      strings: use slice instead of list and array in Fields comment · d180d186
      Martin Möhrmann authored
      Change-Id: I70b839ff0ae5f015587390a82616ebb1d657d71a
      Reviewed-on: https://go-review.googlesource.com/55490Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d180d186
    • Martin Möhrmann's avatar
      runtime: replace some uses of newarray with newobject for maps · 248a7c7c
      Martin Möhrmann authored
      This avoids the never triggered capacity checks in newarray.
      
      Change-Id: Ib72b204adcb9e3fd3ab963defe0cd40e22d5d492
      Reviewed-on: https://go-review.googlesource.com/54731
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      248a7c7c
    • Martin Möhrmann's avatar
      bytes: speed up Fields and FieldsFunc · 7df29b50
      Martin Möhrmann authored
      Applies the optimizations from golang.org/cl/42810 and golang.org/cl/37959
      done to the strings package to the bytes package.
      
      name                      old time/op    new time/op     delta
      Fields/ASCII/16              417ns ± 4%      118ns ± 3%    -71.65%  (p=0.000 n=10+10)
      Fields/ASCII/256            5.95µs ± 3%     0.88µs ± 0%    -85.23%  (p=0.000 n=10+7)
      Fields/ASCII/4096           92.3µs ± 1%     12.8µs ± 2%    -86.13%  (p=0.000 n=10+10)
      Fields/ASCII/65536          1.49ms ± 1%     0.25ms ± 1%    -83.14%  (p=0.000 n=10+10)
      Fields/ASCII/1048576        25.0ms ± 1%      6.5ms ± 2%    -74.04%  (p=0.000 n=10+10)
      Fields/Mixed/16              406ns ± 1%      222ns ± 1%    -45.24%  (p=0.000 n=10+9)
      Fields/Mixed/256            5.78µs ± 1%     2.27µs ± 1%    -60.73%  (p=0.000 n=9+10)
      Fields/Mixed/4096           97.9µs ± 1%     40.5µs ± 3%    -58.66%  (p=0.000 n=10+10)
      Fields/Mixed/65536          1.58ms ± 1%     0.69ms ± 1%    -56.58%  (p=0.000 n=10+10)
      Fields/Mixed/1048576        26.6ms ± 1%     12.6ms ± 2%    -52.44%  (p=0.000 n=9+10)
      FieldsFunc/ASCII/16          395ns ± 1%      188ns ± 1%    -52.34%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/256        5.90µs ± 1%     2.00µs ± 1%    -66.06%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/4096       92.5µs ± 1%     33.0µs ± 1%    -64.34%  (p=0.000 n=10+9)
      FieldsFunc/ASCII/65536      1.48ms ± 1%     0.54ms ± 1%    -63.38%  (p=0.000 n=10+9)
      FieldsFunc/ASCII/1048576    25.1ms ± 1%     10.5ms ± 3%    -58.24%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/16          401ns ± 1%      205ns ± 2%    -48.87%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/256        5.70µs ± 1%     1.98µs ± 1%    -65.28%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/4096       97.5µs ± 1%     35.4µs ± 1%    -63.65%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/65536      1.57ms ± 1%     0.61ms ± 1%    -61.20%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/1048576    26.5ms ± 1%     11.4ms ± 2%    -56.84%  (p=0.000 n=10+10)
      
      name                      old speed      new speed       delta
      Fields/ASCII/16           38.4MB/s ± 4%  134.9MB/s ± 3%   +251.55%  (p=0.000 n=10+10)
      Fields/ASCII/256          43.0MB/s ± 3%  290.6MB/s ± 1%   +575.97%  (p=0.000 n=10+8)
      Fields/ASCII/4096         44.4MB/s ± 1%  320.0MB/s ± 2%   +620.90%  (p=0.000 n=10+10)
      Fields/ASCII/65536        44.0MB/s ± 1%  260.7MB/s ± 1%   +493.15%  (p=0.000 n=10+10)
      Fields/ASCII/1048576      42.0MB/s ± 1%  161.6MB/s ± 2%   +285.21%  (p=0.000 n=10+10)
      Fields/Mixed/16           39.4MB/s ± 1%   71.7MB/s ± 1%    +82.20%  (p=0.000 n=10+10)
      Fields/Mixed/256          44.3MB/s ± 1%  112.8MB/s ± 1%   +154.64%  (p=0.000 n=9+10)
      Fields/Mixed/4096         41.9MB/s ± 1%  101.2MB/s ± 3%   +141.92%  (p=0.000 n=10+10)
      Fields/Mixed/65536        41.5MB/s ± 1%   95.5MB/s ± 1%   +130.29%  (p=0.000 n=10+10)
      Fields/Mixed/1048576      39.4MB/s ± 1%   82.9MB/s ± 2%   +110.28%  (p=0.000 n=9+10)
      FieldsFunc/ASCII/16       40.5MB/s ± 1%   84.9MB/s ± 2%   +109.80%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/256      43.4MB/s ± 1%  127.9MB/s ± 1%   +194.58%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/4096     44.3MB/s ± 1%  124.2MB/s ± 1%   +180.44%  (p=0.000 n=10+9)
      FieldsFunc/ASCII/65536    44.2MB/s ± 1%  120.6MB/s ± 1%   +173.06%  (p=0.000 n=10+9)
      FieldsFunc/ASCII/1048576  41.8MB/s ± 1%  100.2MB/s ± 3%   +139.53%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/16       39.8MB/s ± 1%   77.8MB/s ± 2%    +95.46%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/256      44.9MB/s ± 1%  129.4MB/s ± 1%   +187.97%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/4096     42.0MB/s ± 1%  115.6MB/s ± 1%   +175.08%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/65536    41.6MB/s ± 1%  107.3MB/s ± 1%   +157.75%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/1048576  39.6MB/s ± 1%   91.8MB/s ± 2%   +131.72%  (p=0.000 n=10+10)
      
      name                      old alloc/op   new alloc/op    delta
      Fields/ASCII/16              80.0B ± 0%      80.0B ± 0%       ~     (all equal)
      Fields/ASCII/256              768B ± 0%       768B ± 0%       ~     (all equal)
      Fields/ASCII/4096           9.47kB ± 0%     9.47kB ± 0%       ~     (all equal)
      Fields/ASCII/65536           147kB ± 0%      147kB ± 0%       ~     (all equal)
      Fields/ASCII/1048576        2.27MB ± 0%     2.27MB ± 0%       ~     (all equal)
      Fields/Mixed/16              96.0B ± 0%      96.0B ± 0%       ~     (all equal)
      Fields/Mixed/256              768B ± 0%       768B ± 0%       ~     (all equal)
      Fields/Mixed/4096           9.47kB ± 0%    24.83kB ± 0%   +162.16%  (p=0.000 n=10+10)
      Fields/Mixed/65536           147kB ± 0%      497kB ± 0%   +237.24%  (p=0.000 n=10+10)
      Fields/Mixed/1048576        2.26MB ± 0%     9.61MB ± 0%   +324.89%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/16          80.0B ± 0%      80.0B ± 0%       ~     (all equal)
      FieldsFunc/ASCII/256          768B ± 0%       768B ± 0%       ~     (all equal)
      FieldsFunc/ASCII/4096       9.47kB ± 0%    24.83kB ± 0%   +162.16%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/65536       147kB ± 0%      497kB ± 0%   +237.24%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/1048576    2.27MB ± 0%     9.61MB ± 0%   +323.72%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/16          96.0B ± 0%      96.0B ± 0%       ~     (all equal)
      FieldsFunc/Mixed/256          768B ± 0%       768B ± 0%       ~     (all equal)
      FieldsFunc/Mixed/4096       9.47kB ± 0%    24.83kB ± 0%   +162.16%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/65536       147kB ± 0%      497kB ± 0%   +237.24%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/1048576    2.26MB ± 0%     9.61MB ± 0%   +324.89%  (p=0.000 n=10+10)
      
      name                      old allocs/op  new allocs/op   delta
      Fields/ASCII/16               1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      Fields/ASCII/256              1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      Fields/ASCII/4096             1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      Fields/ASCII/65536            1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      Fields/ASCII/1048576          1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      Fields/Mixed/16               1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      Fields/Mixed/256              1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      Fields/Mixed/4096             1.00 ± 0%       5.00 ± 0%   +400.00%  (p=0.000 n=10+10)
      Fields/Mixed/65536            1.00 ± 0%      12.00 ± 0%  +1100.00%  (p=0.000 n=10+10)
      Fields/Mixed/1048576          1.00 ± 0%      24.00 ± 0%  +2300.00%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/16           1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      FieldsFunc/ASCII/256          1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      FieldsFunc/ASCII/4096         1.00 ± 0%       5.00 ± 0%   +400.00%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/65536        1.00 ± 0%      12.00 ± 0%  +1100.00%  (p=0.000 n=10+10)
      FieldsFunc/ASCII/1048576      1.00 ± 0%      24.00 ± 0%  +2300.00%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/16           1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      FieldsFunc/Mixed/256          1.00 ± 0%       1.00 ± 0%       ~     (all equal)
      FieldsFunc/Mixed/4096         1.00 ± 0%       5.00 ± 0%   +400.00%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/65536        1.00 ± 0%      12.00 ± 0%  +1100.00%  (p=0.000 n=10+10)
      FieldsFunc/Mixed/1048576      1.00 ± 0%      24.00 ± 0%  +2300.00%  (p=0.000 n=10+10)
      
      Change-Id: If1926782decc2f60d3b4b8c41c2ce7d8bdedfd8f
      Reviewed-on: https://go-review.googlesource.com/55131
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      7df29b50
    • Martin Möhrmann's avatar
      strconv: unify error creation in ParseUint with ParseInt · dd6880d6
      Martin Möhrmann authored
      Remove goto and use helper functions in ParseUint to create errors.
      
      Change-Id: I1c4677ae1b9980db79065a9f8ca1f2c470249505
      Reviewed-on: https://go-review.googlesource.com/55135
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      dd6880d6
    • Martin Möhrmann's avatar
      strconv: adjust test output and names for parseUint and parseInt · 566f390c
      Martin Möhrmann authored
      Instead of printing Atoi as function name for test failures
      print the actual function name and arguments tested.
      
      Add a base field to the parseUint64BaseTests for consistency with
      the parseInt64BaseTests tests.
      
      Change-Id: Ib9891bdb87b62672b4216625212acfe6474c70fc
      Reviewed-on: https://go-review.googlesource.com/55136
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      566f390c
    • Keith Randall's avatar
      runtime: add a use of runtime.KeepAlive's argument · 2c990f45
      Keith Randall authored
      This makes sure that its argument is marked live on entry.
      We need its arg to be live so defers of KeepAlive get
      scanned correctly by the GC.
      
      Fixes #21402
      
      Change-Id: I906813e433d0e9726ca46483723303338da5b4d7
      Reviewed-on: https://go-review.googlesource.com/55150
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      2c990f45