1. 11 Sep, 2018 7 commits
    • Ian Lance Taylor's avatar
      cmd/link: don't pass all linker args when testing flag · 023dbb18
      Ian Lance Taylor authored
      Some linker flags can actually be input files, which can cause
      misleading errors when doing the trial link, which can cause the
      linker to incorrectly decide that the flag is not supported, which can
      cause the link to fail.
      
      Fixes #27510
      Updates #27110
      Updates #27293
      
      Change-Id: I70c1e913cee3c813e7b267bf779bcff26d4d194a
      Reviewed-on: https://go-review.googlesource.com/134057
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarLynn Boger <laboger@linux.vnet.ibm.com>
      Reviewed-by: 's avatarDamien Neil <dneil@google.com>
      023dbb18
    • Bryan C. Mills's avatar
      cmd/go/testdata/script: fix typos in test comments · 1a1c45b3
      Bryan C. Mills authored
      Change-Id: I2a55cda76f1074b997349dfd6e001dc7277faade
      Reviewed-on: https://go-review.googlesource.com/134655Reviewed-by: 's avatarDaniel Martí <mvdan@mvdan.cc>
      1a1c45b3
    • Brian Kessler's avatar
      math/bits: add extended precision Add, Sub, Mul, Div · 13de5e7f
      Brian Kessler authored
      Port math/big pure go versions of add-with-carry, subtract-with-borrow,
      full-width multiply, and full-width divide.
      
      Updates #24813
      
      Change-Id: Ifae5d2f6ee4237137c9dcba931f69c91b80a4b1c
      Reviewed-on: https://go-review.googlesource.com/123157Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      13de5e7f
    • Yury Smolsky's avatar
      cmd/compile: use yyerrorl(n.Pos, ...) in typecheckdef · ef7212e2
      Yury Smolsky authored
      n.Pos.IsKnown() is not needed because it is performed in setlineno.
      
      toolstash-check passed.
      
      Updates #19683.
      
      Change-Id: I34d6a0e6dc9970679d99e8f3424f289ebf1e86ba
      Reviewed-on: https://go-review.googlesource.com/114915
      Run-TryBot: Yury Smolsky <yury@smolsky.by>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      ef7212e2
    • Lynn Boger's avatar
      cmd/link,compress/zip,image/png: use binary.{Big,Little}Endian methods · aa4fc0e7
      Lynn Boger authored
      Use the binary.{Big,Little}Endian integer encoding methods rather than
      variations found in local implementations. The functions in
      the binary package have been tested to ensure they inline correctly and
      don't add unnecessary bounds checking.
      
      Change-Id: Ie10111ca6edb7c11e8e5e21c58a5748ae99b7f87
      Reviewed-on: https://go-review.googlesource.com/134375
      Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMichael Munday <mike.munday@ibm.com>
      aa4fc0e7
    • Ben Shi's avatar
      cmd/compile: optimize arm's bit operation · 9f241189
      Ben Shi authored
      BFC (Bit Field Clear) was introduced in ARMv7, which can simplify
      ANDconst and BICconst. And this CL implements that optimization.
      
      1. The total size of pkg/android_arm decreases about 3KB, excluding
      cmd/compile/.
      
      2. There is no regression in the go1 benchmark result, and some
      cases (FmtFprintfEmpty-4 and RegexpMatchMedium_32-4) even get
      slight improvement.
      
      name                     old time/op    new time/op    delta
      BinaryTree17-4              25.3s ± 1%     25.2s ± 1%    ~     (p=0.072 n=30+29)
      Fannkuch11-4                13.3s ± 0%     13.3s ± 0%  +0.13%  (p=0.000 n=30+26)
      FmtFprintfEmpty-4           407ns ± 0%     394ns ± 0%  -3.19%  (p=0.000 n=26+28)
      FmtFprintfString-4          664ns ± 0%     662ns ± 0%  -0.22%  (p=0.000 n=30+30)
      FmtFprintfInt-4             712ns ± 0%     706ns ± 0%  -0.79%  (p=0.000 n=30+30)
      FmtFprintfIntInt-4         1.06µs ± 0%    1.05µs ± 0%  -0.38%  (p=0.000 n=30+30)
      FmtFprintfPrefixedInt-4    1.16µs ± 0%    1.16µs ± 0%  -0.13%  (p=0.000 n=30+29)
      FmtFprintfFloat-4          2.24µs ± 0%    2.23µs ± 0%  -0.51%  (p=0.000 n=29+21)
      FmtManyArgs-4              4.09µs ± 0%    4.06µs ± 0%  -0.83%  (p=0.000 n=28+30)
      GobDecode-4                55.0ms ± 5%    55.4ms ± 5%    ~     (p=0.307 n=30+30)
      GobEncode-4                51.2ms ± 1%    51.9ms ± 1%  +1.23%  (p=0.000 n=29+30)
      Gzip-4                      2.64s ± 0%     2.60s ± 0%  -1.35%  (p=0.000 n=30+29)
      Gunzip-4                    309ms ± 0%     308ms ± 0%  -0.27%  (p=0.000 n=30+30)
      HTTPClientServer-4         1.03ms ± 5%    1.02ms ± 4%    ~     (p=0.117 n=30+29)
      JSONEncode-4                101ms ± 2%     101ms ± 2%    ~     (p=0.338 n=29+29)
      JSONDecode-4                383ms ± 2%     382ms ± 2%    ~     (p=0.751 n=26+30)
      Mandelbrot200-4            18.4ms ± 0%    18.4ms ± 0%  -0.10%  (p=0.000 n=29+29)
      GoParse-4                  22.6ms ± 0%    22.5ms ± 0%  -0.39%  (p=0.000 n=30+30)
      RegexpMatchEasy0_32-4       761ns ± 0%     750ns ± 0%  -1.47%  (p=0.000 n=26+29)
      RegexpMatchEasy0_1K-4      4.33µs ± 0%    4.34µs ± 0%  +0.27%  (p=0.000 n=25+28)
      RegexpMatchEasy1_32-4       809ns ± 0%     795ns ± 0%  -1.74%  (p=0.000 n=27+25)
      RegexpMatchEasy1_1K-4      5.54µs ± 0%    5.53µs ± 0%  -0.18%  (p=0.000 n=29+29)
      RegexpMatchMedium_32-4     1.11µs ± 0%    1.08µs ± 0%  -2.78%  (p=0.000 n=27+29)
      RegexpMatchMedium_1K-4      255µs ± 0%     255µs ± 0%  -0.02%  (p=0.029 n=30+30)
      RegexpMatchHard_32-4       14.7µs ± 0%    14.7µs ± 0%  -0.28%  (p=0.000 n=30+29)
      RegexpMatchHard_1K-4        439µs ± 0%     439µs ± 0%    ~     (p=0.907 n=23+27)
      Revcomp-4                  41.9ms ± 1%    41.9ms ± 1%    ~     (p=0.230 n=28+30)
      Template-4                  522ms ± 1%     528ms ± 1%  +1.25%  (p=0.000 n=30+30)
      TimeParse-4                3.34µs ± 0%    3.35µs ± 0%  +0.23%  (p=0.000 n=30+27)
      TimeFormat-4               6.06µs ± 0%    6.13µs ± 0%  +1.08%  (p=0.000 n=29+29)
      [Geo mean]                  384µs          382µs       -0.37%
      
      name                     old speed      new speed      delta
      GobDecode-4              14.0MB/s ± 5%  13.9MB/s ± 5%    ~     (p=0.308 n=30+30)
      GobEncode-4              15.0MB/s ± 1%  14.8MB/s ± 1%  -1.22%  (p=0.000 n=29+30)
      Gzip-4                   7.36MB/s ± 0%  7.46MB/s ± 0%  +1.35%  (p=0.000 n=30+30)
      Gunzip-4                 62.8MB/s ± 0%  63.0MB/s ± 0%  +0.27%  (p=0.000 n=30+30)
      JSONEncode-4             19.2MB/s ± 2%  19.2MB/s ± 2%    ~     (p=0.312 n=29+29)
      JSONDecode-4             5.05MB/s ± 3%  5.08MB/s ± 2%    ~     (p=0.356 n=29+30)
      GoParse-4                2.56MB/s ± 0%  2.57MB/s ± 0%  +0.39%  (p=0.000 n=23+27)
      RegexpMatchEasy0_32-4    42.0MB/s ± 0%  42.6MB/s ± 0%  +1.50%  (p=0.000 n=26+28)
      RegexpMatchEasy0_1K-4     236MB/s ± 0%   236MB/s ± 0%  -0.27%  (p=0.000 n=25+28)
      RegexpMatchEasy1_32-4    39.6MB/s ± 0%  40.2MB/s ± 0%  +1.73%  (p=0.000 n=27+27)
      RegexpMatchEasy1_1K-4     185MB/s ± 0%   185MB/s ± 0%  +0.18%  (p=0.000 n=29+29)
      RegexpMatchMedium_32-4    900kB/s ± 0%   920kB/s ± 0%  +2.22%  (p=0.000 n=29+29)
      RegexpMatchMedium_1K-4   4.02MB/s ± 0%  4.02MB/s ± 0%  +0.07%  (p=0.004 n=30+27)
      RegexpMatchHard_32-4     2.17MB/s ± 0%  2.18MB/s ± 0%  +0.46%  (p=0.000 n=30+26)
      RegexpMatchHard_1K-4     2.33MB/s ± 0%  2.33MB/s ± 0%    ~     (all equal)
      Revcomp-4                60.6MB/s ± 1%  60.7MB/s ± 1%    ~     (p=0.207 n=28+30)
      Template-4               3.72MB/s ± 1%  3.67MB/s ± 1%  -1.23%  (p=0.000 n=30+30)
      [Geo mean]               12.9MB/s       12.9MB/s       +0.29%
      
      Change-Id: I07f497f8bb476c950dc555491d00c9066fb64a4e
      Reviewed-on: https://go-review.googlesource.com/134232
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      9f241189
    • Ian Davis's avatar
      net/url: remove an allocation for short strings in escape · 95a11c73
      Ian Davis authored
      Use a 64 byte array to avoid an allocation on the assumption that
      most url escaping is performed on short strings. Also adds a fast
      path for escaping strings whose only replacements are spaces which
      is common in query components.
      
      Adds benchmarks for QueryEscape, PathEscape, QueryUnescape and
      PathUnescape but no optimizations are include for the unescape functions
      so I don't include those benchmark results here.
      
      Reduces allocations by 10% in the existing String benchmark with a
      modest performance increase.
      
      name               old time/op    new time/op    delta
      QueryEscape/#00-8    64.6ns ± 1%    43.8ns ± 0%  -32.14%  (p=0.000 n=9+9)
      QueryEscape/#01-8     276ns ± 3%     249ns ± 0%   -9.62%  (p=0.000 n=10+7)
      QueryEscape/#02-8     176ns ± 2%     155ns ± 3%  -12.21%  (p=0.000 n=10+10)
      QueryEscape/#03-8     388ns ± 1%     362ns ± 0%   -6.55%  (p=0.000 n=10+8)
      QueryEscape/#04-8    2.32µs ± 2%    2.27µs ± 2%   -2.26%  (p=0.001 n=10+10)
      PathEscape/#00-8     78.0ns ± 3%    63.4ns ± 1%  -18.69%  (p=0.000 n=10+10)
      PathEscape/#01-8      276ns ± 2%     260ns ± 0%   -6.01%  (p=0.000 n=10+10)
      PathEscape/#02-8      175ns ± 0%     153ns ± 0%  -12.53%  (p=0.000 n=8+10)
      PathEscape/#03-8      389ns ± 2%     361ns ± 0%   -7.21%  (p=0.000 n=10+9)
      PathEscape/#04-8     2.30µs ± 2%    2.27µs ± 1%   -1.33%  (p=0.001 n=9+10)
      String-8             3.56µs ± 4%    3.42µs ± 7%   -4.00%  (p=0.003 n=10+10)
      
      name               old alloc/op   new alloc/op   delta
      QueryEscape/#00-8     16.0B ± 0%      8.0B ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#01-8      128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#02-8     64.0B ± 0%     32.0B ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#03-8      128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#04-8      832B ± 0%      832B ± 0%     ~     (all equal)
      PathEscape/#00-8      32.0B ± 0%     16.0B ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#01-8       128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#02-8      64.0B ± 0%     32.0B ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#03-8       128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#04-8       704B ± 0%      704B ± 0%     ~     (all equal)
      String-8             1.84kB ± 0%    1.66kB ± 0%   -9.57%  (p=0.000 n=10+10)
      
      name               old allocs/op  new allocs/op  delta
      QueryEscape/#00-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#01-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#02-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#03-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      QueryEscape/#04-8      2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      PathEscape/#00-8       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#01-8       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#02-8       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#03-8       2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      PathEscape/#04-8       2.00 ± 0%      2.00 ± 0%     ~     (all equal)
      String-8               69.0 ± 0%      61.0 ± 0%  -11.59%  (p=0.000 n=10+10)
      
      Updates #17860
      
      Change-Id: I45c5e9d40b242f874c61f6ccc73bf94c494bb868
      Reviewed-on: https://go-review.googlesource.com/134296
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      95a11c73
  2. 10 Sep, 2018 2 commits
  3. 09 Sep, 2018 3 commits
  4. 08 Sep, 2018 3 commits
  5. 07 Sep, 2018 13 commits
    • Michael Pratt's avatar
      runtime: use tgkill for raise · 43f54c8d
      Michael Pratt authored
      raise uses tkill to send a signal to the current thread. For this use,
      tgkill is functionally equivalent to tkill expect that it also takes the
      pid as the first argument.
      
      Using tgkill makes it simpler to run a Go program in a strict sandbox.
      With kill and tgkill, the sandbox policy (e.g., seccomp) can prevent the
      program from sending signals to other processes by checking that the
      first argument == getpid().
      
      With tkill, the policy must whitelist all tids in the process, which is
      effectively impossible given Go's dynamic thread creation.
      
      Fixes #27548
      
      Change-Id: I8ed282ef1f7215b02ef46de144493e36454029ea
      Reviewed-on: https://go-review.googlesource.com/133975
      Run-TryBot: Michael Pratt <mpratt@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      43f54c8d
    • Ian Lance Taylor's avatar
      cmd/go: add -Wl,--export-dynamic to linker flag whitelist · ceb7745c
      Ian Lance Taylor authored
      Fixes #27496
      
      Change-Id: I53538c7697729294a9e50ace26a6a7183131e837
      Reviewed-on: https://go-review.googlesource.com/134016
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAndrew Bonventre <andybons@golang.org>
      ceb7745c
    • Iskander Sharipov's avatar
      test: extend noescape bytes.Buffer test suite · b7f9c640
      Iskander Sharipov authored
      Added some more cases that should be guarded against regression.
      
      Change-Id: I9f1dda2fd0be9b6e167ef1cc018fc8cce55c066c
      Reviewed-on: https://go-review.googlesource.com/134017
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      b7f9c640
    • Filippo Valsorda's avatar
      crypto/x509: allow ":" in Common Name hostnames · 7a0eb564
      Filippo Valsorda authored
      At least one popular service puts a hostname which contains a ":"
      in the Common Name field. On the other hand, I don't know of any name
      constrained certificates that only work if we ignore such CNs.
      
      Updates #24151
      
      Change-Id: I2d813e3e522ebd65ab5ea5cd83390467a869eea3
      Reviewed-on: https://go-review.googlesource.com/134076
      Run-TryBot: Filippo Valsorda <filippo@golang.org>
      Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7a0eb564
    • Keith Randall's avatar
      runtime: in semasleep, subtract time spent so far from timeout · 42257a26
      Keith Randall authored
      When pthread_cond_timedwait_relative_np gets a spurious wakeup
      (due to a signal, typically), we used to retry with the same
      relative timeout. That's incorrect, we should lower the timeout
      by the time we've spent in this function so far.
      
      In the worst case, signals come in and cause spurious wakeups
      faster than the timeout, causing semasleep to never time out.
      
      Also fix nacl and netbsd while we're here. They have similar issues.
      
      Fixes #27520
      
      Change-Id: I6601e120e44a4b8ef436eef75a1e7c8cf1d39e39
      Reviewed-on: https://go-review.googlesource.com/133655
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      42257a26
    • erifan01's avatar
      cmd/compile: implement non-constant rotates using ROR on arm64 · 204cc14b
      erifan01 authored
      Add some rules to match the Go code like:
      	y &= 63
      	x << y | x >> (64-y)
      or
      	y &= 63
      	x >> y | x << (64-y)
      as a ROR instruction. Make math/bits.RotateLeft faster on arm64.
      
      Extends CL 132435 to arm64.
      
      Benchmarks of math/bits.RotateLeftxxN:
      name            old time/op       new time/op       delta
      RotateLeft-8    3.548750ns +- 1%  2.003750ns +- 0%  -43.54%  (p=0.000 n=8+8)
      RotateLeft8-8   3.925000ns +- 0%  3.925000ns +- 0%     ~     (p=1.000 n=8+8)
      RotateLeft16-8  3.925000ns +- 0%  3.927500ns +- 0%     ~     (p=0.608 n=8+8)
      RotateLeft32-8  3.925000ns +- 0%  2.002500ns +- 0%  -48.98%  (p=0.000 n=8+8)
      RotateLeft64-8  3.536250ns +- 0%  2.003750ns +- 0%  -43.34%  (p=0.000 n=8+8)
      
      Change-Id: I77622cd7f39b917427e060647321f5513973232c
      Reviewed-on: https://go-review.googlesource.com/122542
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      204cc14b
    • Tobias Klauser's avatar
      cmd/dist, go/types: add support for GOARCH=sparc64 · d8c8a142
      Tobias Klauser authored
      This is needed in addition to CL 102555 in order to be able to generate
      Go type definitions for linux/sparc64 in the golang.org/x/sys/unix
      package.
      
      Change-Id: I928185e320572fecb0c89396f871ea16cba8b9a6
      Reviewed-on: https://go-review.googlesource.com/132155
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      d8c8a142
    • Thanabodee Charoenpiriyakij's avatar
      fmt: add example for Sprint · 7bee8085
      Thanabodee Charoenpiriyakij authored
      Updates #27376
      
      Change-Id: I9ce6541a95b5ecd13f3932558427de1f597df07a
      Reviewed-on: https://go-review.googlesource.com/134036
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      7bee8085
    • Thanabodee Charoenpiriyakij's avatar
      fmt: add example for Print · b7182acf
      Thanabodee Charoenpiriyakij authored
      Updates #27376
      
      Change-Id: I2fa63b0d1981a419626072d985e6f3326f6013ff
      Reviewed-on: https://go-review.googlesource.com/134035
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      b7182acf
    • Thanabodee Charoenpiriyakij's avatar
      fmt: add example for Fprint · 9facf355
      Thanabodee Charoenpiriyakij authored
      Updates #27376
      
      Change-Id: I0ceb672a9fcd7bbf491be1577d7f135ef35b2561
      Reviewed-on: https://go-review.googlesource.com/133455
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      9facf355
    • Tobias Klauser's avatar
      debug/elf: add R_RISCV_32_PCREL relocation · f64c0b2a
      Tobias Klauser authored
      This were missed in CL 107339 as it is not documented (yet) in
      https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md
      
      But binutils already uses it. See
      https://github.com/riscv/riscv-elf-psabi-doc/issues/36
      
      Change-Id: I1b084cbf70eb6ac966136bed1bb654883a97b6a9
      Reviewed-on: https://go-review.googlesource.com/134015
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f64c0b2a
    • Marko Kevac's avatar
      runtime/pprof: remove "deleted" suffix while parsing maps file · 73b8e5f8
      Marko Kevac authored
      If binary file of a running program was deleted or moved, maps
      file (/proc/pid/maps) will contain lines that have this binary
      filename suffixed with "(deleted)" string. This suffix stayed
      as a part of the filename and made remote profiling slightly more
      difficult by requiring from a user to rename binary file to
      include this suffix.
      
      This change cleans up the filename and removes this suffix and
      thus simplify debugging.
      
      Fixes #25740
      
      Change-Id: Ib3c8c3b9ef536c2ac037fcc14e8037fa5c960036
      Reviewed-on: https://go-review.googlesource.com/116395
      Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      73b8e5f8
    • Ben Shi's avatar
      cmd/compile: optimize 386's comparison · 031a35ec
      Ben Shi authored
      Optimization of "(CMPconst [0] (ANDL x y)) -> (TESTL x y)" only
      get benefits if there is no further use of the result of x&y. A
      condition of uses==1 will have slight improvements.
      
      1. The code size of pkg/linux_386 decreases about 300 bytes, excluding
      cmd/compile/.
      
      2. The go1 benchmark shows no regression, and even a slight improvement
      in test case FmtFprintfEmpty-4, excluding noise.
      
      name                     old time/op    new time/op    delta
      BinaryTree17-4              3.34s ± 3%     3.32s ± 2%    ~     (p=0.197 n=30+30)
      Fannkuch11-4                3.48s ± 2%     3.47s ± 1%  -0.33%  (p=0.015 n=30+30)
      FmtFprintfEmpty-4          46.3ns ± 4%    44.8ns ± 4%  -3.33%  (p=0.000 n=30+30)
      FmtFprintfString-4         78.8ns ± 7%    77.3ns ± 5%    ~     (p=0.098 n=30+26)
      FmtFprintfInt-4            90.2ns ± 1%    90.0ns ± 7%  -0.23%  (p=0.027 n=18+30)
      FmtFprintfIntInt-4          144ns ± 4%     143ns ± 5%    ~     (p=0.945 n=30+29)
      FmtFprintfPrefixedInt-4     180ns ± 4%     180ns ± 5%    ~     (p=0.858 n=30+30)
      FmtFprintfFloat-4           409ns ± 4%     406ns ± 3%  -0.87%  (p=0.028 n=30+30)
      FmtManyArgs-4               611ns ± 5%     608ns ± 4%    ~     (p=0.812 n=30+30)
      GobDecode-4                7.30ms ± 5%    7.26ms ± 5%    ~     (p=0.522 n=30+29)
      GobEncode-4                6.90ms ± 7%    6.82ms ± 4%    ~     (p=0.086 n=29+28)
      Gzip-4                      396ms ± 4%     400ms ± 4%  +0.99%  (p=0.026 n=30+30)
      Gunzip-4                   41.1ms ± 3%    41.2ms ± 3%    ~     (p=0.495 n=30+30)
      HTTPClientServer-4         63.7µs ± 3%    63.3µs ± 2%    ~     (p=0.113 n=29+29)
      JSONEncode-4               16.1ms ± 2%    16.1ms ± 2%  -0.30%  (p=0.041 n=30+30)
      JSONDecode-4               60.9ms ± 3%    61.2ms ± 6%    ~     (p=0.187 n=30+30)
      Mandelbrot200-4            5.17ms ± 2%    5.19ms ± 3%    ~     (p=0.676 n=30+30)
      GoParse-4                  3.28ms ± 3%    3.25ms ± 2%  -0.97%  (p=0.002 n=30+30)
      RegexpMatchEasy0_32-4       103ns ± 4%     104ns ± 4%    ~     (p=0.352 n=30+30)
      RegexpMatchEasy0_1K-4       849ns ± 2%     845ns ± 2%    ~     (p=0.381 n=30+30)
      RegexpMatchEasy1_32-4       113ns ± 4%     113ns ± 4%    ~     (p=0.795 n=30+30)
      RegexpMatchEasy1_1K-4      1.03µs ± 3%    1.03µs ± 4%    ~     (p=0.275 n=25+30)
      RegexpMatchMedium_32-4      132ns ± 3%     132ns ± 3%    ~     (p=0.970 n=30+30)
      RegexpMatchMedium_1K-4     41.4µs ± 3%    41.4µs ± 3%    ~     (p=0.212 n=30+30)
      RegexpMatchHard_32-4       2.22µs ± 4%    2.22µs ± 4%    ~     (p=0.399 n=30+30)
      RegexpMatchHard_1K-4       67.2µs ± 3%    67.6µs ± 4%    ~     (p=0.359 n=30+30)
      Revcomp-4                   1.84s ± 2%     1.83s ± 2%    ~     (p=0.532 n=30+30)
      Template-4                 69.1ms ± 4%    68.8ms ± 3%    ~     (p=0.146 n=30+30)
      TimeParse-4                 441ns ± 3%     442ns ± 3%    ~     (p=0.154 n=30+30)
      TimeFormat-4                413ns ± 3%     414ns ± 3%    ~     (p=0.275 n=30+30)
      [Geo mean]                 66.2µs         66.0µs       -0.28%
      
      name                     old speed      new speed      delta
      GobDecode-4               105MB/s ± 5%   106MB/s ± 5%    ~     (p=0.514 n=30+29)
      GobEncode-4               111MB/s ± 5%   113MB/s ± 4%  +1.37%  (p=0.046 n=28+28)
      Gzip-4                   49.1MB/s ± 4%  48.6MB/s ± 4%  -0.98%  (p=0.028 n=30+30)
      Gunzip-4                  472MB/s ± 4%   472MB/s ± 3%    ~     (p=0.496 n=30+30)
      JSONEncode-4              120MB/s ± 2%   121MB/s ± 2%  +0.29%  (p=0.042 n=30+30)
      JSONDecode-4             31.9MB/s ± 3%  31.7MB/s ± 6%    ~     (p=0.186 n=30+30)
      GoParse-4                17.6MB/s ± 3%  17.8MB/s ± 2%  +0.98%  (p=0.002 n=30+30)
      RegexpMatchEasy0_32-4     309MB/s ± 4%   307MB/s ± 4%    ~     (p=0.501 n=30+30)
      RegexpMatchEasy0_1K-4    1.21GB/s ± 2%  1.21GB/s ± 2%    ~     (p=0.301 n=30+30)
      RegexpMatchEasy1_32-4     283MB/s ± 4%   282MB/s ± 3%    ~     (p=0.877 n=30+30)
      RegexpMatchEasy1_1K-4    1.00GB/s ± 3%  0.99GB/s ± 4%    ~     (p=0.276 n=25+30)
      RegexpMatchMedium_32-4   7.54MB/s ± 3%  7.55MB/s ± 3%    ~     (p=0.528 n=30+30)
      RegexpMatchMedium_1K-4   24.7MB/s ± 3%  24.7MB/s ± 3%    ~     (p=0.203 n=30+30)
      RegexpMatchHard_32-4     14.4MB/s ± 4%  14.4MB/s ± 4%    ~     (p=0.407 n=30+30)
      RegexpMatchHard_1K-4     15.3MB/s ± 3%  15.1MB/s ± 4%    ~     (p=0.306 n=30+30)
      Revcomp-4                 138MB/s ± 2%   139MB/s ± 2%    ~     (p=0.520 n=30+30)
      Template-4               28.1MB/s ± 4%  28.2MB/s ± 3%    ~     (p=0.149 n=30+30)
      [Geo mean]               81.5MB/s       81.5MB/s       +0.06%
      
      Change-Id: I7f75425f79eec93cdd8fdd94db13ad4f61b6a2f5
      Reviewed-on: https://go-review.googlesource.com/133657
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      031a35ec
  6. 06 Sep, 2018 8 commits
    • fanzha02's avatar
      cmd/compile: optimize math.Copysign on arm64 · 2e5c3251
      fanzha02 authored
      Add rewrite rules to optimize math.Copysign() when the second
      argument is negative floating point constant.
      
      For example, math.Copysign(c, -2): The previous compile output is
      "AND $9223372036854775807, R0, R0; ORR $-9223372036854775808, R0, R0".
      The optimized compile output is "ORR $-9223372036854775808, R0, R0"
      
      Math package benchmark results.
      name                   old time/op  new time/op  delta
      Copysign-8             2.61ns ± 2%  2.49ns ± 0%  -4.55%  (p=0.000 n=10+10)
      Cos-8                  43.0ns ± 0%  41.5ns ± 0%  -3.49%  (p=0.000 n=10+10)
      Cosh-8                 98.6ns ± 0%  98.1ns ± 0%  -0.51%  (p=0.000 n=10+10)
      ExpGo-8                 107ns ± 0%   105ns ± 0%  -1.87%  (p=0.000 n=10+10)
      Exp2Go-8                100ns ± 0%   100ns ± 0%  +0.39%  (p=0.000 n=10+8)
      Max-8                  6.56ns ± 2%  6.45ns ± 1%  -1.63%  (p=0.002 n=10+10)
      Min-8                  6.66ns ± 3%  6.47ns ± 2%  -2.82%  (p=0.006 n=10+10)
      Mod-8                   107ns ± 1%   104ns ± 1%  -2.72%  (p=0.000 n=10+10)
      Frexp-8                11.5ns ± 1%  11.0ns ± 0%  -4.56%  (p=0.000 n=8+10)
      HypotGo-8              19.4ns ± 0%  19.4ns ± 0%  +0.36%  (p=0.019 n=10+10)
      Ilogb-8                8.63ns ± 0%  8.51ns ± 0%  -1.36%  (p=0.000 n=10+10)
      Jn-8                    584ns ± 0%   585ns ± 0%  +0.17%  (p=0.000 n=7+8)
      Ldexp-8                13.8ns ± 0%  13.5ns ± 0%  -2.17%  (p=0.002 n=8+10)
      Logb-8                 10.2ns ± 0%   9.9ns ± 0%  -2.65%  (p=0.000 n=10+7)
      Nextafter64-8          7.54ns ± 0%  7.51ns ± 0%  -0.37%  (p=0.000 n=10+10)
      Remainder-8            73.5ns ± 1%  70.4ns ± 1%  -4.27%  (p=0.000 n=10+10)
      SqrtGoLatency-8        79.6ns ± 0%  76.2ns ± 0%  -4.30%  (p=0.000 n=9+10)
      Yn-8                    582ns ± 0%   579ns ± 0%  -0.52%  (p=0.000 n=10+10)
      
      Change-Id: I0c9cd1ea87435e7b8bab94b4e79e6e29785f25b1
      Reviewed-on: https://go-review.googlesource.com/132915Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      2e5c3251
    • fanzha02's avatar
      cmd/internal/obj/arm64: add CONSTRAINED UNPREDICTABLE behavior check for some load/store · 7ab4b558
      fanzha02 authored
      According to ARM64 manual, it is "constrained unpredictable behavior"
      if the src and dst registers of some load/store instructions are same.
      In order to completely prevent such unpredictable behavior, adding the
      check for load/store instructions that are supported by the assembler
      in the assembler.
      
      Add test cases.
      
      Update #25823
      
      Change-Id: I64c14ad99ee543d778e7ec8ae6516a532293dbb3
      Reviewed-on: https://go-review.googlesource.com/120660
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      7ab4b558
    • Iskander Sharipov's avatar
      bytes: remove bootstrap array from Buffer · 9c2be4c2
      Iskander Sharipov authored
      Rationale: small buffer optimization does not work and it has
      made things slower since 2014. Until we can make it work,
      we should prefer simpler code that also turns out to be more
      efficient.
      
      With this change, it's possible to use
      NewBuffer(make([]byte, 0, bootstrapSize)) to get the desired
      stack-allocated initial buffer since escape analysis can
      prove the created slice to be non-escaping.
      
      New implementation key points:
      
          - Zero value bytes.Buffer performs better than before
          - You can have a truly stack-allocated buffer, and it's not even limited to 64 bytes
          - The unsafe.Sizeof(bytes.Buffer{}) is reduced significantly
          - Empty writes don't cause allocations
      
      Buffer benchmarks from bytes package:
      
          name                       old time/op    new time/op    delta
          ReadString-8                 9.20µs ± 1%    9.22µs ± 1%     ~     (p=0.148 n=10+10)
          WriteByte-8                  28.1µs ± 0%    26.2µs ± 0%   -6.78%  (p=0.000 n=10+10)
          WriteRune-8                  64.9µs ± 0%    65.0µs ± 0%   +0.16%  (p=0.000 n=10+10)
          BufferNotEmptyWriteRead-8     469µs ± 0%     461µs ± 0%   -1.76%  (p=0.000 n=9+10)
          BufferFullSmallReads-8        108µs ± 0%     108µs ± 0%   -0.21%  (p=0.000 n=10+10)
      
          name                       old speed      new speed      delta
          ReadString-8               3.56GB/s ± 1%  3.55GB/s ± 1%     ~     (p=0.165 n=10+10)
          WriteByte-8                 146MB/s ± 0%   156MB/s ± 0%   +7.26%  (p=0.000 n=9+10)
          WriteRune-8                 189MB/s ± 0%   189MB/s ± 0%   -0.16%  (p=0.000 n=10+10)
      
          name                       old alloc/op   new alloc/op   delta
          ReadString-8                 32.8kB ± 0%    32.8kB ± 0%     ~     (all equal)
          WriteByte-8                   0.00B          0.00B          ~     (all equal)
          WriteRune-8                   0.00B          0.00B          ~     (all equal)
          BufferNotEmptyWriteRead-8    4.72kB ± 0%    4.67kB ± 0%   -1.02%  (p=0.000 n=10+10)
          BufferFullSmallReads-8       3.44kB ± 0%    3.33kB ± 0%   -3.26%  (p=0.000 n=10+10)
      
          name                       old allocs/op  new allocs/op  delta
          ReadString-8                   1.00 ± 0%      1.00 ± 0%     ~     (all equal)
          WriteByte-8                    0.00           0.00          ~     (all equal)
          WriteRune-8                    0.00           0.00          ~     (all equal)
          BufferNotEmptyWriteRead-8      3.00 ± 0%      3.00 ± 0%     ~     (all equal)
          BufferFullSmallReads-8         3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=10+10)
      
      The most notable thing in go1 benchmarks is reduced allocs in HTTPClientServer (-1 alloc):
      
          HTTPClientServer-8           64.0 ± 0%      63.0 ± 0%  -1.56%  (p=0.000 n=10+10)
      
      For more explanations and benchmarks see the referenced issue.
      
      Updates #7921
      
      Change-Id: Ica0bf85e1b70fb4f5dc4f6a61045e2cf4ef72aa3
      Reviewed-on: https://go-review.googlesource.com/133715Reviewed-by: 's avatarMartin Möhrmann <moehrmann@google.com>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      9c2be4c2
    • Jake B's avatar
      net: ensure WriteTo on Windows sends even zero-byte payloads · 3e5b5d69
      Jake B authored
      This builds on:
      https://github.com/golang/go/pull/27445
      
      "...And then send change to fix windows internal/poll.FD.WriteTo - together with making TestUDPZeroBytePayload run again."
      - alexbrainman - https://github.com/golang/go/issues/26668#issuecomment-408657503
      
      Fixes #26668
      
      Change-Id: Icd9ecb07458f13e580b3e7163a5946ccec342509
      GitHub-Last-Rev: 3bf2b8b46bb8cf79903930631433a1f2ce50ec42
      GitHub-Pull-Request: golang/go#27446
      Reviewed-on: https://go-review.googlesource.com/132781
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAlex Brainman <alex.brainman@gmail.com>
      3e5b5d69
    • Ian Davis's avatar
      encoding/json: recover saved error context when unmarshalling · 22afb357
      Ian Davis authored
      Fixes: #27464
      
      Change-Id: I270c56fd0d5ae8787a1293029aff3072f4f52f33
      Reviewed-on: https://go-review.googlesource.com/132955Reviewed-by: 's avatarDaniel Martí <mvdan@mvdan.cc>
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      22afb357
    • Warren Fernandes's avatar
      expvar: fix name of Var interface · 6b7099ca
      Warren Fernandes authored
      Change-Id: Ibc40237981fdd20316f73f7f6f3dfa918dd0af5d
      Reviewed-on: https://go-review.googlesource.com/133658Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      6b7099ca
    • Warren Fernandes's avatar
      fmt: add example for GoStringer interface · 262d4f32
      Warren Fernandes authored
      Updates golang/go#27376.
      
      Change-Id: Ia8608561eb6a268aa7eae8c39c7098df100b643a
      Reviewed-on: https://go-review.googlesource.com/133075Reviewed-by: 's avatarKevin Burke <kev@inburke.com>
      Run-TryBot: Kevin Burke <kev@inburke.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      262d4f32
    • taylorza's avatar
      cmd/compile: don't crash reporting misuse of shadowed built-in function · 4a095b87
      taylorza authored
      The existing implementation causes a compiler panic if a function parameter shadows a built-in function, and then calling that shadowed name.
      
      Fixes #27356
      Change-Id: I1ffb6dc01e63c7f499e5f6f75f77ce2318f35bcd
      Reviewed-on: https://go-review.googlesource.com/132876Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4a095b87
  7. 05 Sep, 2018 4 commits