1. 10 Sep, 2018 2 commits
  2. 09 Sep, 2018 3 commits
  3. 08 Sep, 2018 3 commits
  4. 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
  5. 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
  6. 05 Sep, 2018 11 commits
    • Daniel Martí's avatar
      text/template: simplify line tracking in the lexer · 98fd6680
      Daniel Martí authored
      First, move the strings.Count logic out of emit, since only itemText
      requires that. Use it in those call sites. itemLeftDelim and
      itemRightDelim cannot contain newlines, as they're the "{{" and "}}"
      tokens.
      
      Secondly, introduce a startLine lexer field so that we don't have to
      keep track of it elsewhere. That's also a requirement to move the
      strings.Count out of emit, as emit modifies the start position field.
      
      Change-Id: I69175f403487607a8e5b561b3f1916ee9dc3c0c6
      Reviewed-on: https://go-review.googlesource.com/132275
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRob Pike <r@golang.org>
      98fd6680
    • Michael Munday's avatar
      cmd/compile: regenerate known formats for TestFormats · 2524ed19
      Michael Munday authored
      The formatting verb '%#x' was used for uint32 values in CL 132956.
      This fixes TestFormats.
      
      Change-Id: I3ab6519bde2cb74410fdca14829689cb46bf7022
      Reviewed-on: https://go-review.googlesource.com/133595
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDaniel Martí <mvdan@mvdan.cc>
      2524ed19
    • Robert Griesemer's avatar
      go/types: fix internal comments and add additional test case · 3c1b7bc7
      Robert Griesemer authored
      https://go-review.googlesource.com/c/go/+/132355 addressed
      a crash and inadvertently fixed #27346; however the comment
      added to the type-checker was incorrect and misleading.
      
      This CL fixes the comment, and adds a test case for #27346.
      
      Fixes #27346.
      Updates #22467.
      
      Change-Id: Ib6d5caedf302fd42929c4dacc55e973c1aebfe85
      Reviewed-on: https://go-review.googlesource.com/133415
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRebecca Stambler <rstambler@golang.org>
      3c1b7bc7
    • Michael Munday's avatar
      cmd/compile: fix store-to-load forwarding of 32-bit sNaNs · 48af3a8b
      Michael Munday authored
      Signalling NaNs were being converted to quiet NaNs during constant
      propagation through integer <-> float store-to-load forwarding.
      This occurs because we store float32 constants as float64
      values and CPU hardware 'quietens' NaNs during conversion between
      the two.
      
      Eventually we want to move to using float32 values to store float32
      constants, however this will be a big change since both the compiler
      and the assembler expect float64 values. So for now this is a small
      change that will fix the immediate issue.
      
      Fixes #27193.
      
      Change-Id: Iac54bd8c13abe26f9396712bc71f9b396f842724
      Reviewed-on: https://go-review.googlesource.com/132956
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      48af3a8b
    • Ben Shi's avatar
      cmd/compile: optimize ARM's comparision · 067dfce2
      Ben Shi authored
      Optimize (CMPconst [0] (ADD x y)) to (CMN x y) will only get benefits
      when the result of the addition is no longer used, otherwise there
      might be even performance drop. And this CL fixes that issue for
      CMP/CMN/TST/TEQ.
      
      There is little regression in the go1 benchmark (excluding noise),
      and the test case JSONDecode-4 even gets improvement.
      
      name                     old time/op    new time/op    delta
      BinaryTree17-4              21.6s ± 1%     21.6s ± 0%  -0.22%  (p=0.013 n=30+30)
      Fannkuch11-4                11.1s ± 0%     11.1s ± 0%  +0.11%  (p=0.000 n=30+29)
      FmtFprintfEmpty-4           297ns ± 0%     297ns ± 0%  +0.08%  (p=0.007 n=26+28)
      FmtFprintfString-4          589ns ± 1%     589ns ± 0%    ~     (p=0.659 n=30+25)
      FmtFprintfInt-4             644ns ± 1%     650ns ± 0%  +0.88%  (p=0.000 n=30+24)
      FmtFprintfIntInt-4          964ns ± 0%     977ns ± 0%  +1.33%  (p=0.000 n=30+30)
      FmtFprintfPrefixedInt-4    1.06µs ± 0%    1.07µs ± 0%  +1.31%  (p=0.000 n=29+27)
      FmtFprintfFloat-4          1.89µs ± 0%    1.92µs ± 0%  +1.25%  (p=0.000 n=29+29)
      FmtManyArgs-4              3.63µs ± 0%    3.67µs ± 0%  +1.33%  (p=0.000 n=29+27)
      GobDecode-4                38.1ms ± 1%    37.9ms ± 1%  -0.60%  (p=0.000 n=29+29)
      GobEncode-4                35.3ms ± 2%    35.2ms ± 1%    ~     (p=0.286 n=30+30)
      Gzip-4                      2.36s ± 0%     2.37s ± 2%    ~     (p=0.277 n=24+28)
      Gunzip-4                    264ms ± 1%     264ms ± 1%    ~     (p=0.104 n=28+30)
      HTTPClientServer-4         1.04ms ± 4%    1.02ms ± 4%  -1.65%  (p=0.000 n=28+28)
      JSONEncode-4               78.5ms ± 1%    79.6ms ± 1%  +1.34%  (p=0.000 n=27+28)
      JSONDecode-4                379ms ± 4%     352ms ± 5%  -7.09%  (p=0.000 n=29+30)
      Mandelbrot200-4            17.6ms ± 0%    17.6ms ± 0%    ~     (p=0.206 n=28+29)
      GoParse-4                  21.9ms ± 1%    22.1ms ± 1%  +0.87%  (p=0.000 n=28+26)
      RegexpMatchEasy0_32-4       631ns ± 0%     641ns ± 0%  +1.63%  (p=0.000 n=29+30)
      RegexpMatchEasy0_1K-4      4.11µs ± 0%    4.11µs ± 0%    ~     (p=0.700 n=30+30)
      RegexpMatchEasy1_32-4       670ns ± 0%     679ns ± 0%  +1.37%  (p=0.000 n=21+30)
      RegexpMatchEasy1_1K-4      5.31µs ± 0%    5.26µs ± 0%  -1.03%  (p=0.000 n=25+28)
      RegexpMatchMedium_32-4      905ns ± 0%     906ns ± 0%  +0.14%  (p=0.001 n=30+30)
      RegexpMatchMedium_1K-4      192µs ± 0%     191µs ± 0%  -0.45%  (p=0.000 n=29+27)
      RegexpMatchHard_32-4       11.8µs ± 0%    11.7µs ± 0%  -0.39%  (p=0.000 n=29+28)
      RegexpMatchHard_1K-4        347µs ± 0%     347µs ± 0%    ~     (p=0.084 n=29+30)
      Revcomp-4                  37.5ms ± 1%    37.5ms ± 1%    ~     (p=0.279 n=29+29)
      Template-4                  519ms ± 2%     519ms ± 2%    ~     (p=0.652 n=28+29)
      TimeParse-4                2.83µs ± 0%    2.78µs ± 0%  -1.90%  (p=0.000 n=27+28)
      TimeFormat-4               5.79µs ± 0%    5.60µs ± 0%  -3.23%  (p=0.000 n=29+29)
      [Geo mean]                  331µs          330µs       -0.16%
      
      name                     old speed      new speed      delta
      GobDecode-4              20.1MB/s ± 1%  20.3MB/s ± 1%  +0.61%  (p=0.000 n=29+29)
      GobEncode-4              21.7MB/s ± 2%  21.8MB/s ± 1%    ~     (p=0.294 n=30+30)
      Gzip-4                   8.23MB/s ± 1%  8.20MB/s ± 2%    ~     (p=0.099 n=26+28)
      Gunzip-4                 73.5MB/s ± 1%  73.4MB/s ± 1%    ~     (p=0.107 n=28+30)
      JSONEncode-4             24.7MB/s ± 1%  24.4MB/s ± 1%  -1.32%  (p=0.000 n=27+28)
      JSONDecode-4             5.13MB/s ± 4%  5.52MB/s ± 5%  +7.65%  (p=0.000 n=29+30)
      GoParse-4                2.65MB/s ± 1%  2.63MB/s ± 1%  -0.87%  (p=0.000 n=28+26)
      RegexpMatchEasy0_32-4    50.7MB/s ± 0%  49.9MB/s ± 0%  -1.58%  (p=0.000 n=29+29)
      RegexpMatchEasy0_1K-4     249MB/s ± 0%   249MB/s ± 0%    ~     (p=0.342 n=30+28)
      RegexpMatchEasy1_32-4    47.7MB/s ± 0%  47.1MB/s ± 0%  -1.39%  (p=0.000 n=26+30)
      RegexpMatchEasy1_1K-4     193MB/s ± 0%   195MB/s ± 0%  +1.04%  (p=0.000 n=25+28)
      RegexpMatchMedium_32-4   1.10MB/s ± 0%  1.10MB/s ± 0%  -0.42%  (p=0.000 n=30+26)
      RegexpMatchMedium_1K-4   5.33MB/s ± 0%  5.36MB/s ± 0%  +0.43%  (p=0.000 n=29+29)
      RegexpMatchHard_32-4     2.72MB/s ± 0%  2.73MB/s ± 0%  +0.37%  (p=0.000 n=29+30)
      RegexpMatchHard_1K-4     2.95MB/s ± 0%  2.95MB/s ± 0%    ~     (all equal)
      Revcomp-4                67.8MB/s ± 1%  67.7MB/s ± 1%    ~     (p=0.273 n=29+29)
      Template-4               3.74MB/s ± 2%  3.74MB/s ± 2%    ~     (p=0.665 n=28+29)
      [Geo mean]               15.2MB/s       15.2MB/s       +0.21%
      
      Change-Id: Ifed1fb8cc02d5ca52c8bc6c21b6b5bf6dbb2701a
      Reviewed-on: https://go-review.googlesource.com/132115
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      067dfce2
    • fanzha02's avatar
      cmd/internal/obj/arm64: encode float constants into FMOVS/FMOVD instructions · c430adf1
      fanzha02 authored
      Current assembler rewrites float constants to values stored in memory
      except 0.0, which is not performant. This patch uses the FMOVS/FMOVD
      instructions to move some available floating-point immediate constants
      into SIMD&FP destination registers. These available constants can be
      encoded into FMOVS/FMOVD instructions, checked by the chipfloat7() function.
      
      go1 benchmark results.
      name                     old time/op    new time/op    delta
      BinaryTree17-8              6.27s ± 1%     6.27s ± 1%    ~     (p=0.762 n=10+8)
      Fannkuch11-8                5.42s ± 1%     5.38s ± 0%  -0.63%  (p=0.000 n=10+10)
      FmtFprintfEmpty-8          92.9ns ± 1%    93.4ns ± 0%  +0.47%  (p=0.004 n=9+8)
      FmtFprintfString-8          169ns ± 2%     170ns ± 4%    ~     (p=0.378 n=10+10)
      FmtFprintfInt-8             197ns ± 1%     196ns ± 1%  -0.77%  (p=0.009 n=10+9)
      FmtFprintfIntInt-8          284ns ± 1%     286ns ± 1%    ~     (p=0.051 n=10+10)
      FmtFprintfPrefixedInt-8     419ns ± 0%     422ns ± 1%  +0.69%  (p=0.038 n=6+10)
      FmtFprintfFloat-8           458ns ± 0%     463ns ± 1%  +1.14%  (p=0.000 n=10+10)
      FmtManyArgs-8              1.35µs ± 2%    1.36µs ± 1%  +0.91%  (p=0.043 n=10+10)
      GobDecode-8                16.0ms ± 2%    15.5ms ± 1%   -3.39%  (p=0.000 n=10+10)
      GobEncode-8                11.9ms ± 3%    11.4ms ± 1%   -3.98%  (p=0.000 n=10+9)
      Gzip-8                      621ms ± 0%     625ms ± 0%   +0.59%  (p=0.000 n=9+10)
      Gunzip-8                   74.0ms ± 1%    74.3ms ± 0%     ~     (p=0.059 n=9+8)
      HTTPClientServer-8          116µs ± 1%     116µs ± 1%     ~     (p=0.165 n=10+10)
      JSONEncode-8               29.3ms ± 1%    29.5ms ± 0%   +0.72%  (p=0.001 n=10+10)
      JSONDecode-8                145ms ± 1%     148ms ± 2%   +2.06%  (p=0.000 n=10+10)
      Mandelbrot200-8            9.67ms ± 0%    9.48ms ± 1%   -1.92%  (p=0.000 n=8+10)
      GoParse-8                  7.55ms ± 0%    7.60ms ± 0%   +0.57%  (p=0.000 n=9+10)
      RegexpMatchEasy0_32-8       234ns ± 0%     210ns ± 0%  -10.13%  (p=0.000 n=8+10)
      RegexpMatchEasy0_1K-8       753ns ± 1%     729ns ± 0%   -3.17%  (p=0.000 n=10+8)
      RegexpMatchEasy1_32-8       225ns ± 0%     224ns ± 0%   -0.44%  (p=0.000 n=9+9)
      RegexpMatchEasy1_1K-8      1.03µs ± 0%    1.04µs ± 1%   +1.29%  (p=0.000 n=10+10)
      RegexpMatchMedium_32-8      320ns ± 3%     296ns ± 6%   -7.50%  (p=0.000 n=10+10)
      RegexpMatchMedium_1K-8     77.0µs ± 5%    73.6µs ± 1%     ~     (p=0.393 n=10+10)
      RegexpMatchHard_32-8       3.93µs ± 0%    3.89µs ± 1%   -0.95%  (p=0.000 n=10+9)
      RegexpMatchHard_1K-8        120µs ± 5%     115µs ± 1%     ~     (p=0.739 n=10+10)
      Revcomp-8                   1.07s ± 0%     1.08s ± 1%   +0.63%  (p=0.000 n=10+9)
      Template-8                  165ms ± 1%     163ms ± 1%   -1.05%  (p=0.001 n=8+10)
      TimeParse-8                 751ns ± 1%     749ns ± 1%     ~     (p=0.209 n=10+10)
      TimeFormat-8                759ns ± 1%     751ns ± 1%   -0.96%  (p=0.001 n=10+10)
      
      name                     old speed      new speed      delta
      GobDecode-8              48.0MB/s ± 2%  49.6MB/s ± 1%   +3.50%  (p=0.000 n=10+10)
      GobEncode-8              64.5MB/s ± 3%  67.1MB/s ± 1%   +4.08%  (p=0.000 n=10+9)
      Gzip-8                   31.2MB/s ± 0%  31.1MB/s ± 0%   -0.55%  (p=0.000 n=9+8)
      Gunzip-8                  262MB/s ± 1%   261MB/s ± 0%     ~     (p=0.059 n=9+8)
      JSONEncode-8             66.3MB/s ± 1%  65.8MB/s ± 0%   -0.72%  (p=0.001 n=10+10)
      JSONDecode-8             13.4MB/s ± 1%  13.2MB/s ± 1%   -2.02%  (p=0.000 n=10+10)
      GoParse-8                7.67MB/s ± 0%  7.63MB/s ± 0%   -0.57%  (p=0.000 n=9+10)
      RegexpMatchEasy0_32-8     136MB/s ± 0%   152MB/s ± 0%  +11.45%  (p=0.000 n=10+10)
      RegexpMatchEasy0_1K-8    1.36GB/s ± 1%  1.40GB/s ± 0%   +3.25%  (p=0.000 n=10+8)
      RegexpMatchEasy1_32-8     142MB/s ± 0%   143MB/s ± 0%   +0.35%  (p=0.000 n=10+9)
      RegexpMatchEasy1_1K-8     992MB/s ± 0%   980MB/s ± 1%   -1.27%  (p=0.000 n=10+10)
      RegexpMatchMedium_32-8   3.12MB/s ± 3%  3.38MB/s ± 6%   +8.17%  (p=0.000 n=10+10)
      RegexpMatchMedium_1K-8   13.3MB/s ± 5%  13.9MB/s ± 1%     ~     (p=0.362 n=10+10)
      RegexpMatchHard_32-8     8.14MB/s ± 0%  8.21MB/s ± 1%   +0.95%  (p=0.000 n=10+9)
      RegexpMatchHard_1K-8     8.54MB/s ± 5%  8.90MB/s ± 1%     ~     (p=0.636 n=10+10)
      Revcomp-8                 238MB/s ± 0%   236MB/s ± 1%   -0.63%  (p=0.000 n=10+9)
      Template-8               11.8MB/s ± 1%  11.9MB/s ± 1%   +1.07%  (p=0.001 n=8+10)
      
      Change-Id: I57b372d8dcd47e6aec39893843b20385d5d9c37e
      Reviewed-on: https://go-review.googlesource.com/129555
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      c430adf1
    • Brad Fitzpatrick's avatar
      net: don't block forever in splice test cleanup on failure · 81957dd5
      Brad Fitzpatrick authored
      The ppc64x builders are failing on the new splice test from CL 113997
      but the actual failure is being obscured by a test deadlock.
      
      Change-Id: I7747f88bcdba9776a3c0d2f5066cfec572706108
      Reviewed-on: https://go-review.googlesource.com/133417
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarTobias Klauser <tobias.klauser@gmail.com>
      81957dd5
    • Tobias Klauser's avatar
      net: skip splice unix-to-tcp tests on android · 5789f838
      Tobias Klauser authored
      The android builders are failing on the AF_UNIX part of the new splice
      test from CL 113997. Skip them.
      
      Change-Id: Ia0519aae922acb11d2845aa687633935bcd4b1b0
      Reviewed-on: https://go-review.googlesource.com/133515
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      5789f838
    • Iskander Sharipov's avatar
      cmd/compile/internal/gc: fix mayAffectMemory in esc.go · 4cf33e36
      Iskander Sharipov authored
      For OINDEX and other Left+Right nodes, we want the whole
      node to be considered as "may affect memory" if either
      of Left or Right affect memory. Initial implementation
      only considered node as such if both Left and Right were non-safe.
      
      Change-Id: Icfb965a0b4c24d8f83f3722216db068dad2eba95
      Reviewed-on: https://go-review.googlesource.com/133275
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      4cf33e36
    • Alessandro Arzilli's avatar
      misc/cgo/testplugin: disable DWARF tests on darwin · 3fd36498
      Alessandro Arzilli authored
      For some reason on darwin the linker still can't add debug sections to
      plugins. Executables importing "plugin" do have them, however.
      
      Because of issue 25841, plugins on darwin would likely have bad debug
      info anyway so, for now, this isn't a great loss.
      
      This disables the check for debug sections in plugins for darwin only.
      
      Updates #27502
      
      Change-Id: Ib8f62dac1e485006b0c2b3ba04f86d733db5ee9a
      Reviewed-on: https://go-review.googlesource.com/133435Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      3fd36498
    • Iskander Sharipov's avatar
      test: remove go:noinline from escape_because.go · bcf3e063
      Iskander Sharipov authored
      File is compiled with "-l" flag, so go:noinline is redundant.
      
      Change-Id: Ia269f3b9de9466857fc578ba5164613393e82369
      Reviewed-on: https://go-review.googlesource.com/133295Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      bcf3e063