1. 21 Mar, 2019 1 commit
  2. 20 Mar, 2019 13 commits
    • Josh Bleecher Snyder's avatar
      testing: stop rounding b.N · 03a79e94
      Josh Bleecher Snyder authored
      The original goal of rounding to readable b.N
      was to make it easier to eyeball times.
      However, proper analysis requires tooling
      (such as benchstat) anyway.
      
      Instead, take b.N as it comes.
      This will reduce the impact of external noise
      such as GC on benchmarks.
      
      This requires reworking our iteration estimates.
      We used to calculate the estimated ns/op
      and then divide our target ns by that estimate.
      However, this order of operations was destructive
      when the ns/op was very small; rounding could
      hide almost an order of magnitude of variation.
      Instead, multiply first, then divide.
      Also, make n an int64 to avoid overflow.
      
      Prior to this change, we attempted to cap b.N at 1e9.
      Due to rounding up, it was possible to get b.N as high as 2e9.
      This change consistently enforces the 1e9 cap.
      
      This change also reduces the wall time required to run benchmarks.
      
      Here's the impact of this change on the wall time to run
      all benchmarks once with benchtime=1s on some std packages:
      
      name           old time/op       new time/op       delta
      bytes                 306s ± 1%         238s ± 1%  -22.24%  (p=0.000 n=10+10)
      encoding/json         112s ± 8%          99s ± 7%  -11.64%  (p=0.000 n=10+10)
      net/http             54.7s ± 7%        44.9s ± 4%  -17.94%  (p=0.000 n=10+9)
      runtime               957s ± 1%         714s ± 0%  -25.38%  (p=0.000 n=10+9)
      strings               262s ± 1%         201s ± 1%  -23.27%  (p=0.000 n=10+10)
      [Geo mean]            216s              172s       -20.23%
      
      Updates #24735
      
      Change-Id: I7e38efb8e23c804046bf4fc065b3f5f3991d0a15
      Reviewed-on: https://go-review.googlesource.com/c/go/+/112155Reviewed-by: default avatarAustin Clements <austin@google.com>
      03a79e94
    • Carlos Eduardo Seo's avatar
      cmd/compile/internal, cmd/internal/obj/ppc64: generate new count trailing... · 3023d7da
      Carlos Eduardo Seo authored
      cmd/compile/internal, cmd/internal/obj/ppc64: generate new count trailing zeros instructions on POWER9
      
      This change adds new POWER9 instructions for counting trailing zeros (CNTTZW/CNTTZD)
      to the assembler and generates them in SSA when GOPPC64=power9.
      
      name                 old time/op  new time/op  delta
      TrailingZeros-160    1.59ns ±20%  1.45ns ±10%  -8.81%  (p=0.000 n=14+13)
      TrailingZeros8-160   1.55ns ±23%  1.62ns ±44%    ~     (p=0.593 n=13+15)
      TrailingZeros16-160  1.78ns ±23%  1.62ns ±38%  -9.31%  (p=0.003 n=14+14)
      TrailingZeros32-160  1.64ns ±10%  1.49ns ± 9%  -9.15%  (p=0.000 n=13+14)
      TrailingZeros64-160  1.53ns ± 6%  1.45ns ± 5%  -5.38%  (p=0.000 n=15+13)
      
      Change-Id: I365e6ff79f3ce4d8ebe089a6a86b1771853eb596
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167517Reviewed-by: default avatarLynn Boger <laboger@linux.vnet.ibm.com>
      3023d7da
    • Josh Bleecher Snyder's avatar
      cmd/compile: port callnew to ssa conversion · 23b476a3
      Josh Bleecher Snyder authored
      This is part of a general effort to shrink walk.
      In an ideal world, we'd have an SSA op for allocation,
      but we don't yet have a good mechanism for introducing
      function calling during SSA compilation.
      In the meantime, SSA conversion is a better place for it.
      
      This also makes it easier to introduce new optimizations;
      instead of doing the typecheck walk dance,
      we can simply write what we want the backend to do.
      
      I introduced a new opcode in this change because:
      
      (a) It avoids a class of bugs involving correctly detecting
          whether this ONEW is a "before walk" ONEW or an "after walk" ONEW.
          It also means that using ONEW or ONEWOBJ in the wrong context
          will generally result in a faster failure.
      (b) Opcodes are cheap.
      (c) It provides a better place to put documentation.
      
      This change also is also marginally more performant:
      
      name        old alloc/op      new alloc/op      delta
      Template         39.1MB ± 0%       39.0MB ± 0%  -0.14%  (p=0.008 n=5+5)
      Unicode          28.4MB ± 0%       28.4MB ± 0%    ~     (p=0.421 n=5+5)
      GoTypes           132MB ± 0%        132MB ± 0%  -0.23%  (p=0.008 n=5+5)
      Compiler          608MB ± 0%        607MB ± 0%  -0.25%  (p=0.008 n=5+5)
      SSA              2.04GB ± 0%       2.04GB ± 0%  -0.01%  (p=0.008 n=5+5)
      Flate            24.4MB ± 0%       24.3MB ± 0%  -0.13%  (p=0.008 n=5+5)
      GoParser         29.3MB ± 0%       29.1MB ± 0%  -0.54%  (p=0.008 n=5+5)
      Reflect          84.8MB ± 0%       84.7MB ± 0%  -0.21%  (p=0.008 n=5+5)
      Tar              36.7MB ± 0%       36.6MB ± 0%  -0.10%  (p=0.008 n=5+5)
      XML              48.7MB ± 0%       48.6MB ± 0%  -0.24%  (p=0.008 n=5+5)
      [Geo mean]       85.0MB            84.8MB       -0.19%
      
      name        old allocs/op     new allocs/op     delta
      Template           383k ± 0%         382k ± 0%  -0.26%  (p=0.008 n=5+5)
      Unicode            341k ± 0%         341k ± 0%    ~     (p=0.579 n=5+5)
      GoTypes           1.37M ± 0%        1.36M ± 0%  -0.39%  (p=0.008 n=5+5)
      Compiler          5.59M ± 0%        5.56M ± 0%  -0.49%  (p=0.008 n=5+5)
      SSA               16.9M ± 0%        16.9M ± 0%  -0.03%  (p=0.008 n=5+5)
      Flate              238k ± 0%         238k ± 0%  -0.23%  (p=0.008 n=5+5)
      GoParser           306k ± 0%         303k ± 0%  -0.93%  (p=0.008 n=5+5)
      Reflect            990k ± 0%         987k ± 0%  -0.33%  (p=0.008 n=5+5)
      Tar                356k ± 0%         355k ± 0%  -0.20%  (p=0.008 n=5+5)
      XML                444k ± 0%         442k ± 0%  -0.45%  (p=0.008 n=5+5)
      [Geo mean]         848k              845k       -0.33%
      
      Change-Id: I2c36003a7cbf71b53857b7de734852b698f49310
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167957
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      23b476a3
    • Daniel Martí's avatar
      cmd: update vendored x/tools · fd270d8b
      Daniel Martí authored
      This lets us get rid of a handful of cmd/vet/whitelist/all.txt entries,
      since the stdmethods pass is now happy with the encoding/xml package.
      
      Change-Id: I9de2190984dd00342903967262790c7f6b1f0a75
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168458
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      fd270d8b
    • Damien Neil's avatar
      os: make errors.Is work with ErrPermission et al. · a919b760
      Damien Neil authored
      As proposed in Issue #29934, update errors produced by the os package to
      work with errors.Is sentinel tests. For example,
      errors.Is(err, os.ErrPermission) is equivalent to os.IsPermission(err)
      with added unwrapping support.
      
      Move the definition for os.ErrPermission and others into the syscall
      package. Add an Is method to syscall.Errno and others. Add an Unwrap
      method to os.PathError and others.
      
      Updates #30322
      Updates #29934
      
      Change-Id: I95727d26c18a5354c720de316dff0bffc04dd926
      Reviewed-on: https://go-review.googlesource.com/c/go/+/163058Reviewed-by: default avatarMarcel van Lohuizen <mpvl@golang.org>
      a919b760
    • Clément Chigot's avatar
      cmd/dist: enable cgo for aix/ppc64 · af7b7571
      Clément Chigot authored
      Change-Id: I78be2b0b857d1ea2fb0b6906eb5afd796580f52d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164019
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      af7b7571
    • Clément Chigot's avatar
      cmd/dist, misc/cgo: enable tests for aix/ppc64 · 125d187f
      Clément Chigot authored
      Some cgo tests aren't yet available on aix/ppc64.
      -shared and -static don't work as expected and will be fixed latter.
      
      Updates #30565
      
      Change-Id: Ic59cabe685cb1cbdf89a8d1d1a1d2c4b0e8ef442
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164018
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      125d187f
    • Clément Chigot's avatar
      cmd/nm: fix cgo tests for aix/ppc64 · 1b5b08d1
      Clément Chigot authored
      This commit handles AIX cgo in cmd/nm tests.
      
      Change-Id: I6753a0102e4f2c4c7bd4d7c999f62a0cb3d2183c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/164017
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      1b5b08d1
    • Jonathan Amsterdam's avatar
      os: add PathError.Unwrap · b41eef24
      Jonathan Amsterdam authored
      Add an Unwrap method to PathError so it works with the errors.Is/As
      functions.
      
      Change-Id: Ia6171c0418584f3cd53ee99d97c687941a9e3109
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168097Reviewed-by: default avatarDamien Neil <dneil@google.com>
      b41eef24
    • LE Manh Cuong's avatar
      os: fix windows Lstat missing name for some files · 9e0e9ac5
      LE Manh Cuong authored
      On Windows, GetFileAttributesEx fails with ERROR_SHARING_VIOLATION for
      some files, like c:\pagefile.sys. In this case,
      newFileStatFromWin32finddata is used to fill file info, but it does not fill
      name and path.
      
      After getting file stat from newFileStatFromWin32finddata, just set file info
      name and path before return fixes the issue.
      
      Fixes #30883
      
      Change-Id: I654e96c634e8a9bf5ce7e1aaa93968e88953620d
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167779
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      9e0e9ac5
    • Mikio Hara's avatar
      runtime: disable event scanning error reporting on solaris · e0181ff5
      Mikio Hara authored
      It seems like we need to pay special attention to capturing error
      condition on the event port of SmartOS. The previous attempt CL 167777
      works on Oracle Solaris but doesn't work on SmartOS for the uncertain
      reason. It's better to disable the reporting for now.
      
      Updates #30624.
      Fixes #30840.
      
      Change-Id: Ieca5dac4fceb7e8c9cb4db149bb4c2e79691588c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167782
      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>
      e0181ff5
    • erifan01's avatar
      cmd/compile: intrinsify math/bits.Add64 for arm64 · 5714c91b
      erifan01 authored
      This CL instrinsifies Add64 with arm64 instruction sequence ADDS, ADCS
      and ADC, and optimzes the case of carry chains.The CL also changes the
      test code so that the intrinsic implementation can be tested.
      
      Benchmarks:
      name               old time/op       new time/op       delta
      Add-224            2.500000ns +- 0%  2.090000ns +- 4%  -16.40%  (p=0.000 n=9+10)
      Add32-224          2.500000ns +- 0%  2.500000ns +- 0%     ~     (all equal)
      Add64-224          2.500000ns +- 0%  1.577778ns +- 2%  -36.89%  (p=0.000 n=10+9)
      Add64multiple-224  6.000000ns +- 0%  2.000000ns +- 0%  -66.67%  (p=0.000 n=10+10)
      
      Change-Id: I6ee91c9a85c16cc72ade5fd94868c579f16c7615
      Reviewed-on: https://go-review.googlesource.com/c/go/+/159017
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      5714c91b
    • Rob Pike's avatar
      cmd/go: fix minor grammatical nit: command-line is an adjective... · 456f3e10
      Rob Pike authored
      while command line is a noun.
      
      Change-Id: I9dfc2f6841d1171854857a8daa785d55afe2c5f3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167783Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      456f3e10
  3. 19 Mar, 2019 23 commits
  4. 18 Mar, 2019 3 commits
    • Keith Randall's avatar
      cmd/compile: better write barrier removal when initializing new objects · ca36af21
      Keith Randall authored
      When initializing a new object, we're often writing
      1) to a location that doesn't have a pointer to a heap object
      2) a pointer that doesn't point to a heap object
      
      When both those conditions are true, we can avoid the write barrier.
      
      This CL detects case 1 by looking for writes to known-zeroed
      locations.  The results of runtime.newobject are zeroed, and we
      perform a simple tracking of which parts of that object are written so
      we can determine what part remains zero at each write.
      
      This CL detects case 2 by looking for addresses of globals (including
      the types and itabs which are used in interfaces) and for nil pointers.
      
      Makes cmd/go 0.3% smaller. Some particular cases, like the slice
      literal in #29573, can get much smaller.
      
      TODO: we can remove actual zero writes also with this mechanism.
      
      Update #29573
      
      Change-Id: Ie74a3533775ea88da0495ba02458391e5db26cb9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/156363
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      ca36af21
    • Philipp Stephani's avatar
      cmd/cgo: use C exact-width integer types to represent Go types · 08751259
      Philipp Stephani authored
      The exact-width integer types are required to use two’s complement
      representation and may not have padding bits, cf. §7.20.1.1/1 in the C11
      standard or https://en.cppreference.com/w/c/types/integer.  This ensures that
      they have the same domain and representation as the corresponding Go types.
      
      Fixes #29878
      
      Change-Id: Ie8a51e91666dfd89731c7859abe47356c94ca1be
      GitHub-Last-Rev: 546a2cc3f1e22dc282757f73c01c91b00899d911
      GitHub-Pull-Request: golang/go#29907
      Reviewed-on: https://go-review.googlesource.com/c/go/+/159258
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      08751259
    • Keith Randall's avatar
      cmd/compile: rename init function from init.ializers back to init · 7b916243
      Keith Randall authored
      The name change init -> init.ializers was initially required for
      initialization code.
      
      With CL 161337 there's no wrapper code any more, there's a data
      structure instead (named .inittask). So we can go back to just
      plain init appearing in tracebacks.
      
      RELNOTE=yes
      
      Update #29919. Followon to CL 161337.
      
      Change-Id: I5a4a49d286df24b53b2baa193dfda482f3ea82a5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167780
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7b916243