1. 13 Mar, 2019 11 commits
    • Michael Munday's avatar
      cmd/compile: try and access last argument first in rulegen · 04f1b65c
      Michael Munday authored
      This reduces the number of extra bounds check hints we need to
      insert. For example, rather than producing:
      
      	_ = v.Args[2]
      	x := v.Args[0]
      	y := v.Args[1]
      	z := v.Args[2]
      
      We now produce:
      
      	z := v.Args[2]
      	x := v.Args[0]
      	y := v.Args[1]
      
      This gets rid of about 7000 lines of code from the rewrite rules.
      
      Change-Id: I1291cf0f82e8d035a6d65bce7dee6cedee04cbcd
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167397Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      04f1b65c
    • Bryan C. Mills's avatar
      cmd/go/internal/modload: remove unused InitGoMod function · 5d4fa147
      Bryan C. Mills authored
      Change-Id: I0223d935184017e841d56abe114d78b670457c5a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167437
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5d4fa147
    • Carlos Eduardo Seo's avatar
      cmd/compile: add processor level selection support to ppc64{,le} · 4ba69a9a
      Carlos Eduardo Seo authored
      ppc64{,le} processor level selection allows the compiler to generate instructions
      targeting newer processors and processor-specific optimizations without breaking
      compatibility with our current baseline. This feature introduces a new environment
      variable, GOPPC64.
      
      GOPPC64 is a GOARCH=ppc64{,le} specific option, for a choice between different
      processor levels (i.e. Instruction Set Architecture versions) for which the
      compiler will target. The default is 'power8'.
      
      Change-Id: Ic152e283ae1c47084ece4346fa002a3eabb3bb9e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/163758
      Run-TryBot: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      4ba69a9a
    • David Chase's avatar
      cmd/compile: move statement marks from jumps to targets · 82af9e67
      David Chase authored
      When a jump at the end of a block is about to be marked as
      a statement, if the first real instruction in the target
      block is also a statement for the same line, remove the
      mark from the jump.
      
      This is a first effort at a minimal-harm heuristic.
      A better heuristic might skip over any "not-statement"
      values preceding a definitely marked value.
      
      Fixes #29443.
      
      Change-Id: Ibd52783713b4936e0c2dfda8d708bf186f33b00a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/159977
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlessandro Arzilli <alessandro.arzilli@gmail.com>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      82af9e67
    • Bryan C. Mills's avatar
      cmd/go/internal/{modconv,modfetch,modload}: set modfetch proxy URL in tests · bd680d94
      Bryan C. Mills authored
      Fixes #30571
      
      Change-Id: Id4c74e83ee58a080d1c2894ae5ebdbf4aeb1ce42
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167084
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      bd680d94
    • Daniel Martí's avatar
      cmd/go/internal/base: remove MergeEnvLists · 2f02daaa
      Daniel Martí authored
      This internally exported function allowed merging environment variable
      lists, and was mostly a convenience for the rest of cmd/go/internal.
      It seems to date all the way back to 2013.
      
      However, since CL 37586 in early 2017, os/exec has already taken care of
      deduplicating environment variable lists. Thus, it's unnecessary for
      cmd/go to take care of that before calling exec.Cmd.Start.
      
      Moreover, because os/exec will deduplicate the list in any case, we're
      adding extra work in all these scenarios.
      
      Finally, remove an unnecessary addition of GOROOT= in internal/tool.
      cfg.OrigEnv may not have the correct GOROOT set up, but os.Environ does;
      cmd/go's main function makes sure of that.
      
      Change-Id: I1f92f65fb927dc15bc7b0397cfd1a572b6337bb3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164703
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      2f02daaa
    • Daniel Martí's avatar
      encoding/base64: speed up the decoder · 5f403517
      Daniel Martí authored
      Most of the decoding time is spent in the first Decode loop, since the
      rest of the function only deals with the few remaining bytes. Any
      unnecessary work done in that loop body matters tremendously.
      
      One such unnecessary bottleneck was the use of the enc.decodeMap table.
      Since enc is a pointer receiver, and the field is used within the
      non-inlineable function decode64, the decoder must perform a nil check
      at every iteration.
      
      To fix that, move the enc.decodeMap uses to the parent function, where
      we can lift the nil check outside the loop. That gives roughly a 15%
      speed-up. The function no longer performs decoding per se, so rename it.
      While at it, remove the now unnecessary receivers.
      
      An unfortunate side effect of this change is that the loop now contains
      eight bounds checks on src instead of just one. However, not having to
      slice src plus the nil check removal well outweigh the added cost.
      
      The other piece that made decode64 slow was that it wasn't inlined, and
      had multiple branches. Use a simple bitwise-or trick suggested by Roger
      Peppe, and collapse the rest of the bitwise logic into a single
      expression. Inlinability and the reduced branching give a further 10%
      speed-up.
      
      Finally, add these two functions to TestIntendedInlining, since we want
      them to stay inlinable.
      
      Apply the same refactor to decode32 for consistency, and to let 32-bit
      architectures see a similar performance gain for large inputs.
      
      name                 old time/op    new time/op    delta
      DecodeString/2-8       47.3ns ± 1%    45.8ns ± 0%   -3.28%  (p=0.002 n=6+6)
      DecodeString/4-8       55.8ns ± 2%    51.5ns ± 0%   -7.71%  (p=0.004 n=5+6)
      DecodeString/8-8       64.9ns ± 0%    61.7ns ± 0%   -4.99%  (p=0.004 n=5+6)
      DecodeString/64-8       238ns ± 0%     198ns ± 0%  -16.54%  (p=0.002 n=6+6)
      DecodeString/8192-8    19.5µs ± 0%    14.6µs ± 0%  -24.96%  (p=0.004 n=6+5)
      
      name                 old speed      new speed      delta
      DecodeString/2-8     84.6MB/s ± 1%  87.4MB/s ± 0%   +3.38%  (p=0.002 n=6+6)
      DecodeString/4-8      143MB/s ± 2%   155MB/s ± 0%   +8.41%  (p=0.004 n=5+6)
      DecodeString/8-8      185MB/s ± 0%   195MB/s ± 0%   +5.29%  (p=0.004 n=5+6)
      DecodeString/64-8     369MB/s ± 0%   442MB/s ± 0%  +19.78%  (p=0.002 n=6+6)
      DecodeString/8192-8   560MB/s ± 0%   746MB/s ± 0%  +33.27%  (p=0.004 n=6+5)
      
      Updates #19636.
      
      Change-Id: Ib839577b0e3f5a2bb201f5cae580c61365d92894
      Reviewed-on: https://go-review.googlesource.com/c/go/+/151177
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarroger peppe <rogpeppe@gmail.com>
      5f403517
    • Mikio Hara's avatar
      runtime, internal/poll, net: report event scanning error on read event · a5fdd58c
      Mikio Hara authored
      This change makes it possible the runtime-integrated network poller and
      APIs in the package internal/poll to report an event scanning error on a
      read event.
      
      The latest Go releases open up the way of the manipulation of the poller
      for users. On the other hand, it starts misleading users into believing
      that the poller accepts any user-configured file or socket perfectly
      because of not reporting any error on event scanning, as mentioned in
      issue 30426. The initial implementation of the poller was designed for
      just well-configured, validated sockets produced by the package net.
      However, the assumption is now obsolete.
      
      Fixes #30624.
      
      Benchmark results on linux/amd64:
      
      benchmark                              old ns/op     new ns/op     delta
      BenchmarkTCP4OneShot-4                 24649         23979         -2.72%
      BenchmarkTCP4OneShotTimeout-4          25742         24411         -5.17%
      BenchmarkTCP4Persistent-4              5139          5222          +1.62%
      BenchmarkTCP4PersistentTimeout-4       4919          4892          -0.55%
      BenchmarkTCP6OneShot-4                 21182         20767         -1.96%
      BenchmarkTCP6OneShotTimeout-4          23364         22305         -4.53%
      BenchmarkTCP6Persistent-4              4351          4366          +0.34%
      BenchmarkTCP6PersistentTimeout-4       4227          4255          +0.66%
      BenchmarkTCP4ConcurrentReadWrite-4     2309          1839          -20.36%
      BenchmarkTCP6ConcurrentReadWrite-4     2180          1791          -17.84%
      
      benchmark                              old allocs     new allocs   delta
      BenchmarkTCP4OneShot-4                 26             26           +0.00%
      BenchmarkTCP4OneShotTimeout-4          26             26           +0.00%
      BenchmarkTCP4Persistent-4              0              0            +0.00%
      BenchmarkTCP4PersistentTimeout-4       0              0            +0.00%
      BenchmarkTCP6OneShot-4                 26             26           +0.00%
      BenchmarkTCP6OneShotTimeout-4          26             26           +0.00%
      BenchmarkTCP6Persistent-4              0              0            +0.00%
      BenchmarkTCP6PersistentTimeout-4       0              0            +0.00%
      BenchmarkTCP4ConcurrentReadWrite-4     0              0            +0.00%
      BenchmarkTCP6ConcurrentReadWrite-4     0              0            +0.00%
      
      benchmark                              old bytes     new bytes     delta
      BenchmarkTCP4OneShot-4                 2000          2000          +0.00%
      BenchmarkTCP4OneShotTimeout-4          2000          2000          +0.00%
      BenchmarkTCP4Persistent-4              0             0             +0.00%
      BenchmarkTCP4PersistentTimeout-4       0             0             +0.00%
      BenchmarkTCP6OneShot-4                 2144          2144          +0.00%
      BenchmarkTCP6OneShotTimeout-4          2144          2145          +0.05%
      BenchmarkTCP6Persistent-4              0             0             +0.00%
      BenchmarkTCP6PersistentTimeout-4       0             0             +0.00%
      BenchmarkTCP4ConcurrentReadWrite-4     0             0             +0.00%
      BenchmarkTCP6ConcurrentReadWrite-4     0             0             +0.00%
      
      Change-Id: Iab60e504dff5639e688dc5420d852f336508c0af
      Reviewed-on: https://go-review.googlesource.com/c/go/+/166497
      Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      a5fdd58c
    • Clément Chigot's avatar
      cmd: always allow bigtoc generation with gcc on aix/ppc64 · a891f2e2
      Clément Chigot authored
      -mcmodel=large and -Wl,-bbigtoc must always be passed to gcc in order to
      prevent TOC overflow error. However, a warning is still issued by ld. It
      is removed as it doesn't give any useful information.
      
      Change-Id: I95a78e8993cc7b5c0f329654d507409785f7eea6
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164008
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      a891f2e2
    • Agniva De Sarker's avatar
      testing/cover: improve message when a package has no statements · b6544a2a
      Agniva De Sarker authored
      Fixes #25492
      
      Change-Id: Ic1496857524dad0c0a77f3bb80fa084c9bf00aa9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/155777
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      b6544a2a
    • Clément Chigot's avatar
      cmd: disable DWARF with old ld on aix/ppc64 · 0ff9df6b
      Clément Chigot authored
      DWARF relocations isn't working with some older ld, because of
      -Wl,-bnoobjreorder which is needed on Go.
      This commit checks ld's version and disable DWARF generation in cmd/link
      if it's too old. Some tests must therefore be skipped.
      
      Change-Id: I2e794c263eb0dfe0b42e7062fb80c26f086b44d1
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164007
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      0ff9df6b
  2. 12 Mar, 2019 26 commits
  3. 11 Mar, 2019 3 commits
    • Leon Klingele's avatar
      net/http: add missing error checks in tests · 62bfa69e
      Leon Klingele authored
      Change-Id: I73441ba2eb349f0e0f25068e6b24c74dd33f1456
      GitHub-Last-Rev: b9e6705962b94af3b1b720cc9ad6d33d7d3f1425
      GitHub-Pull-Request: golang/go#30017
      Reviewed-on: https://go-review.googlesource.com/c/go/+/160441Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      62bfa69e
    • Josh Bleecher Snyder's avatar
      cmd/compile: make deadcode pass cheaper · c9ccdf1f
      Josh Bleecher Snyder authored
      The deadcode pass runs a lot.
      I'd like it to run even more.
      
      This change adds dedicated storage for deadcode to ssa.Cache.
      In addition to being a nice win now, it makes
      deadcode easier to add other places in the future.
      
      name        old time/op       new time/op       delta
      Template          210ms ± 3%        209ms ± 2%    ~     (p=0.951 n=93+95)
      Unicode          92.2ms ± 3%       93.0ms ± 3%  +0.87%  (p=0.000 n=94+94)
      GoTypes           739ms ± 2%        733ms ± 2%  -0.84%  (p=0.000 n=92+94)
      Compiler          3.51s ± 2%        3.49s ± 2%  -0.57%  (p=0.000 n=94+91)
      SSA               9.80s ± 2%        9.75s ± 2%  -0.57%  (p=0.000 n=95+92)
      Flate             132ms ± 2%        132ms ± 3%    ~     (p=0.165 n=94+98)
      GoParser          160ms ± 3%        159ms ± 3%  -0.42%  (p=0.005 n=96+94)
      Reflect           446ms ± 4%        442ms ± 4%  -0.91%  (p=0.000 n=95+98)
      Tar               186ms ± 3%        186ms ± 2%    ~     (p=0.221 n=94+97)
      XML               252ms ± 2%        250ms ± 2%  -0.55%  (p=0.000 n=95+94)
      [Geo mean]        430ms             429ms       -0.34%
      
      name        old user-time/op  new user-time/op  delta
      Template          256ms ± 3%        257ms ± 3%    ~     (p=0.521 n=94+98)
      Unicode           120ms ± 9%        121ms ± 9%    ~     (p=0.074 n=99+100)
      GoTypes           935ms ± 3%        935ms ± 2%    ~     (p=0.574 n=82+96)
      Compiler          4.56s ± 1%        4.55s ± 2%    ~     (p=0.247 n=88+90)
      SSA               13.6s ± 2%        13.6s ± 1%    ~     (p=0.277 n=94+95)
      Flate             155ms ± 3%        156ms ± 3%    ~     (p=0.181 n=95+100)
      GoParser          193ms ± 8%        184ms ± 6%  -4.39%  (p=0.000 n=100+89)
      Reflect           549ms ± 3%        552ms ± 3%  +0.45%  (p=0.036 n=94+96)
      Tar               230ms ± 4%        230ms ± 4%    ~     (p=0.670 n=97+99)
      XML               315ms ± 5%        309ms ±12%  -2.05%  (p=0.000 n=99+99)
      [Geo mean]        540ms             538ms       -0.47%
      
      name        old alloc/op      new alloc/op      delta
      Template         40.3MB ± 0%       38.9MB ± 0%  -3.36%  (p=0.008 n=5+5)
      Unicode          28.6MB ± 0%       28.4MB ± 0%  -0.90%  (p=0.008 n=5+5)
      GoTypes           137MB ± 0%        132MB ± 0%  -3.65%  (p=0.008 n=5+5)
      Compiler          637MB ± 0%        609MB ± 0%  -4.40%  (p=0.008 n=5+5)
      SSA              2.19GB ± 0%       2.07GB ± 0%  -5.63%  (p=0.008 n=5+5)
      Flate            25.0MB ± 0%       24.1MB ± 0%  -3.80%  (p=0.008 n=5+5)
      GoParser         30.0MB ± 0%       29.1MB ± 0%  -3.17%  (p=0.008 n=5+5)
      Reflect          87.1MB ± 0%       84.4MB ± 0%  -3.05%  (p=0.008 n=5+5)
      Tar              37.3MB ± 0%       36.0MB ± 0%  -3.31%  (p=0.008 n=5+5)
      XML              49.8MB ± 0%       48.0MB ± 0%  -3.69%  (p=0.008 n=5+5)
      [Geo mean]       87.6MB            84.6MB       -3.50%
      
      name        old allocs/op     new allocs/op     delta
      Template           387k ± 0%         380k ± 0%  -1.76%  (p=0.008 n=5+5)
      Unicode            342k ± 0%         341k ± 0%  -0.31%  (p=0.008 n=5+5)
      GoTypes           1.39M ± 0%        1.37M ± 0%  -1.64%  (p=0.008 n=5+5)
      Compiler          5.68M ± 0%        5.60M ± 0%  -1.41%  (p=0.008 n=5+5)
      SSA               17.1M ± 0%        16.8M ± 0%  -1.49%  (p=0.008 n=5+5)
      Flate              240k ± 0%         236k ± 0%  -1.99%  (p=0.008 n=5+5)
      GoParser           309k ± 0%         304k ± 0%  -1.57%  (p=0.008 n=5+5)
      Reflect           1.01M ± 0%        0.99M ± 0%  -2.69%  (p=0.008 n=5+5)
      Tar                360k ± 0%         353k ± 0%  -1.91%  (p=0.008 n=5+5)
      XML                447k ± 0%         441k ± 0%  -1.26%  (p=0.008 n=5+5)
      [Geo mean]         858k              844k       -1.60%
      
      Fixes #15306
      
      Change-Id: I9f558adb911efddead3865542fe2ca71f66fe1da
      Reviewed-on: https://go-review.googlesource.com/c/go/+/166718
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      c9ccdf1f
    • Elias Naur's avatar
      misc/android: copy less from GOROOT to the device · 810809eb
      Elias Naur authored
      The android emulator builders is running out of space after CL 165797
      copied most of GOROOT to the device.
      The pkg directory is by far the largest, so only include what seems
      necessary to build the x/ repositories: pkg/android_$GOARCH and
      pkg/tool/android_$GOARCH.
      
      While here, rename the device root directory to match the exec
      wrapper name and make sure the deferred cleanups actually run before
      os.Exit.
      
      Hopefully fixes the emulator builders.
      
      Updates #23824
      
      Change-Id: I4d1e3ab2c89fd1e5818503d323ddb87f073094da
      Reviewed-on: https://go-review.googlesource.com/c/go/+/166397
      Run-TryBot: Elias Naur <mail@eliasnaur.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      810809eb