1. 20 Sep, 2018 7 commits
  2. 19 Sep, 2018 9 commits
    • Joe Tsai's avatar
      fmt: fix usage of sync.Pool · e82d152e
      Joe Tsai authored
      The current usage of sync.Pool is leaky because it stores an arbitrary
      sized buffer into the pool. However, sync.Pool assumes that all items in the
      pool are interchangeable from a memory cost perspective. Due to the unbounded
      size of a buffer that may be added, it is possible for the pool to eventually
      pin arbitrarily large amounts of memory in a live-lock situation.
      
      As a simple fix, we just set a maximum size that we permit back into the pool.
      
      We do not need to fix the use of a sync.Pool in scan.go since the free method
      has always enforced a maximum capacity since the first commit of the scan logic.
      
      Fixes #27740
      Updates #23199
      
      Change-Id: I875278f7dba42625405df36df3e9b028252ce5e3
      Reviewed-on: https://go-review.googlesource.com/136116Reviewed-by: 's avatarBryan C. Mills <bcmills@google.com>
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e82d152e
    • Bryan C. Mills's avatar
      cmd/go: write an hgrc file in TestMoveHG · 620bd5a3
      Bryan C. Mills authored
      Some variants of Mercurial respond differently to “permission denied” errors
      than to “file not found”, and we set HOME to point to an absolute path that may
      produce the former instead of the latter.
      
      To discourage Mercurial from trying HOME, give it an explicit (empty)
      configuration in the working directory instead.
      
      Change-Id: I82ae99a6892bba7fc3d41b77209ca181d24315e2
      Reviewed-on: https://go-review.googlesource.com/136135Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      620bd5a3
    • Tim Xu's avatar
      clean: clean mod cache should respect "-n" option. · f40dc5cb
      Tim Xu authored
      Clean mod cache should print remove commands and not run them when with set "-n" option.
      Fixes #27458.
      
      Change-Id: I97242cb40c062b347784cdb61653c84a3a7eab44
      GitHub-Last-Rev: 5a6f10cad8c5f2c3916a74ca5eea27b1fdd1dc38
      GitHub-Pull-Request: golang/go#27710
      Reviewed-on: https://go-review.googlesource.com/135695
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBryan C. Mills <bcmills@google.com>
      f40dc5cb
    • Iskander Sharipov's avatar
      cmd/compile/internal/gc: remove redundant for label · 88c1fd64
      Iskander Sharipov authored
      Since there are no nested loops and/or switches,
      loop label can be removed and "bare continue" can be used.
      
      Change-Id: Id642a0859299e4470af544d59884fec51dbb31ee
      Reviewed-on: https://go-review.googlesource.com/135837Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      88c1fd64
    • Iskander Sharipov's avatar
      cmd/compile/internal/gc: handle arith ops in samesafeexpr · c03d0e4f
      Iskander Sharipov authored
      Teach samesafeexpr to handle arithmetic unary and binary ops.
      
      It makes map lookup optimization possible in
      
      	m[k+1] = append(m[k+1], ...)
      	m[-k] = append(m[-k], ...)
      	... etc
      
      Does not cover "+" for strings (concatenation).
      
      Change-Id: Ibbb16ac3faf176958da344be1471b06d7cf33a6c
      Reviewed-on: https://go-review.googlesource.com/135795
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      c03d0e4f
    • Iskander Sharipov's avatar
      cmd/compile/internal/ssa: fix `a == a` to `a == b` · 9850ad04
      Iskander Sharipov authored
      Change-Id: I4ee4f702e1bfc9ad9ea899c255104d5e18cf2c96
      Reviewed-on: https://go-review.googlesource.com/135838Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9850ad04
    • Ben Shi's avatar
      cmd/compile: optimize AMD64's bit wise operation · c6bf9a81
      Ben Shi authored
      Currently "arr[idx] |= 0x80" is compiled to MOVLload->BTSL->MOVLstore.
      And this CL optimizes it to a single BTSLconstmodify. Other bit wise
      operations with a direct memory operand are also implemented.
      
      1. The size of the executable bin/go decreases about 4KB, and the total size
      of pkg/linux_amd64 (excluding cmd/compile) decreases about 0.6KB.
      
      2. There a little improvement in the go1 benchmark test (excluding noise).
      name                     old time/op    new time/op    delta
      BinaryTree17-4              2.66s ± 4%     2.66s ± 3%    ~     (p=0.596 n=49+49)
      Fannkuch11-4                2.38s ± 2%     2.32s ± 2%  -2.69%  (p=0.000 n=50+50)
      FmtFprintfEmpty-4          42.7ns ± 4%    43.2ns ± 7%  +1.31%  (p=0.009 n=50+50)
      FmtFprintfString-4         71.0ns ± 5%    72.0ns ± 3%  +1.33%  (p=0.000 n=50+50)
      FmtFprintfInt-4            80.7ns ± 4%    80.6ns ± 3%    ~     (p=0.931 n=50+50)
      FmtFprintfIntInt-4          125ns ± 3%     126ns ± 4%    ~     (p=0.051 n=50+50)
      FmtFprintfPrefixedInt-4     158ns ± 1%     142ns ± 3%  -9.84%  (p=0.000 n=36+50)
      FmtFprintfFloat-4           215ns ± 4%     212ns ± 4%  -1.23%  (p=0.002 n=50+50)
      FmtManyArgs-4               519ns ± 3%     510ns ± 3%  -1.77%  (p=0.000 n=50+50)
      GobDecode-4                6.49ms ± 6%    6.52ms ± 5%    ~     (p=0.866 n=50+50)
      GobEncode-4                5.93ms ± 8%    6.01ms ± 7%    ~     (p=0.076 n=50+50)
      Gzip-4                      222ms ± 4%     224ms ± 8%  +0.80%  (p=0.001 n=50+50)
      Gunzip-4                   36.6ms ± 5%    36.4ms ± 4%    ~     (p=0.093 n=50+50)
      HTTPClientServer-4         59.1µs ± 1%    58.9µs ± 2%  -0.24%  (p=0.039 n=49+48)
      JSONEncode-4               9.23ms ± 4%    9.21ms ± 5%    ~     (p=0.244 n=50+50)
      JSONDecode-4               48.8ms ± 4%    48.7ms ± 4%    ~     (p=0.653 n=50+50)
      Mandelbrot200-4            3.81ms ± 4%    3.80ms ± 3%    ~     (p=0.834 n=50+50)
      GoParse-4                  3.20ms ± 5%    3.19ms ± 5%    ~     (p=0.494 n=50+50)
      RegexpMatchEasy0_32-4      78.1ns ± 2%    77.4ns ± 3%  -0.86%  (p=0.005 n=50+50)
      RegexpMatchEasy0_1K-4       233ns ± 3%     233ns ± 3%    ~     (p=0.074 n=50+50)
      RegexpMatchEasy1_32-4      74.2ns ± 3%    73.4ns ± 3%  -1.06%  (p=0.000 n=50+50)
      RegexpMatchEasy1_1K-4       369ns ± 2%     364ns ± 4%  -1.41%  (p=0.000 n=36+50)
      RegexpMatchMedium_32-4      109ns ± 4%     107ns ± 3%  -2.06%  (p=0.001 n=50+50)
      RegexpMatchMedium_1K-4     31.5µs ± 3%    30.8µs ± 3%  -2.20%  (p=0.000 n=50+50)
      RegexpMatchHard_32-4       1.57µs ± 3%    1.56µs ± 2%  -0.57%  (p=0.016 n=50+50)
      RegexpMatchHard_1K-4       47.4µs ± 4%    47.0µs ± 3%  -0.82%  (p=0.008 n=50+50)
      Revcomp-4                   414ms ± 7%     412ms ± 7%    ~     (p=0.285 n=50+50)
      Template-4                 64.3ms ± 4%    62.7ms ± 3%  -2.44%  (p=0.000 n=50+50)
      TimeParse-4                 316ns ± 3%     313ns ± 3%    ~     (p=0.122 n=50+50)
      TimeFormat-4                291ns ± 3%     293ns ± 3%  +0.80%  (p=0.001 n=50+50)
      [Geo mean]                 46.5µs         46.2µs       -0.81%
      
      name                     old speed      new speed      delta
      GobDecode-4               118MB/s ± 6%   118MB/s ± 5%    ~     (p=0.863 n=50+50)
      GobEncode-4               130MB/s ± 9%   128MB/s ± 8%    ~     (p=0.076 n=50+50)
      Gzip-4                   87.4MB/s ± 4%  86.8MB/s ± 7%  -0.78%  (p=0.002 n=50+50)
      Gunzip-4                  531MB/s ± 5%   533MB/s ± 4%    ~     (p=0.093 n=50+50)
      JSONEncode-4              210MB/s ± 4%   211MB/s ± 5%    ~     (p=0.247 n=50+50)
      JSONDecode-4             39.8MB/s ± 4%  39.9MB/s ± 4%    ~     (p=0.654 n=50+50)
      GoParse-4                18.1MB/s ± 5%  18.2MB/s ± 5%    ~     (p=0.493 n=50+50)
      RegexpMatchEasy0_32-4     410MB/s ± 2%   413MB/s ± 3%  +0.86%  (p=0.004 n=50+50)
      RegexpMatchEasy0_1K-4    4.39GB/s ± 3%  4.38GB/s ± 3%    ~     (p=0.063 n=50+50)
      RegexpMatchEasy1_32-4     432MB/s ± 3%   436MB/s ± 3%  +1.07%  (p=0.000 n=50+50)
      RegexpMatchEasy1_1K-4    2.77GB/s ± 2%  2.81GB/s ± 4%  +1.46%  (p=0.000 n=36+50)
      RegexpMatchMedium_32-4   9.16MB/s ± 3%  9.35MB/s ± 4%  +2.09%  (p=0.001 n=50+50)
      RegexpMatchMedium_1K-4   32.5MB/s ± 3%  33.2MB/s ± 3%  +2.25%  (p=0.000 n=50+50)
      RegexpMatchHard_32-4     20.4MB/s ± 3%  20.5MB/s ± 2%  +0.56%  (p=0.017 n=50+50)
      RegexpMatchHard_1K-4     21.6MB/s ± 4%  21.8MB/s ± 3%  +0.83%  (p=0.008 n=50+50)
      Revcomp-4                 613MB/s ± 4%   618MB/s ± 7%    ~     (p=0.152 n=48+50)
      Template-4               30.2MB/s ± 4%  30.9MB/s ± 3%  +2.49%  (p=0.000 n=50+50)
      [Geo mean]                127MB/s        128MB/s       +0.64%
      
      Change-Id: If405198283855d75697f66cf894b2bef458f620e
      Reviewed-on: https://go-review.googlesource.com/135422Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      c6bf9a81
    • Iskander Sharipov's avatar
      cmd/compile/internal/gc: simplify `x = x <op> y` to `x <op>= y` · 713edf8b
      Iskander Sharipov authored
      Change-Id: I5afba2c10372252be4b65dae7a95461722de904f
      Reviewed-on: https://go-review.googlesource.com/135835Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      713edf8b
    • Ben Shi's avatar
      cmd/compile: simplify AMD64's assembly generator · d17ac291
      Ben Shi authored
      AMD64's ADDQconstmodify/ADDLconstmodify have similar logic with
      other constmodify like operators, but seperated case statements.
      This CL simplify them with a fallthrough.
      
      Change-Id: Ia73ffeaddc5080182f68c06c9d9b48fe32a14e38
      Reviewed-on: https://go-review.googlesource.com/135855
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      d17ac291
  3. 18 Sep, 2018 12 commits
  4. 17 Sep, 2018 12 commits