1. 27 Nov, 2018 10 commits
    • Keith Randall's avatar
      cmd/compile: don't use CMOV ops to compute load addresses · 0b79dde1
      Keith Randall authored
      We want to issue loads as soon as possible, especially when they
      are going to miss in the cache. Using a conditional move (CMOV) here:
      
      i := ...
      if cond {
         i++
      }
      ... = a[i]
      
      means that we have to wait for cond to be computed before the load
      is issued. Without a CMOV, if the branch is predicted correctly the
      load can be issued in parallel with computing cond.
      Even if the branch is predicted incorrectly, maybe the speculative
      load is close to the real load, and we get a prefetch for free.
      In the worst case, when the prediction is wrong and the address is
      way off, we only lose by the time difference between the CMOV
      latency (~2 cycles) and the mispredict restart latency (~15 cycles).
      
      We only squash CMOVs that affect load addresses. Results of CMOVs
      that are used for other things (store addresses, store values) we
      use as before.
      
      Fixes #26306
      
      Change-Id: I82ca14b664bf05e1d45e58de8c4d9c775a127ca1
      Reviewed-on: https://go-review.googlesource.com/c/145717
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      0b79dde1
    • Clément Chigot's avatar
      test: fix nilptr5 for AIX · 5680874e
      Clément Chigot authored
      This commit fixes a mistake made in CL 144538.
      This nilcheck can be removed because OpPPC64LoweredMove will fault if
      arg0 is nil, as it's used to store. Further information can be found in
      cmd/compile/internal/ssa/nilcheck.go.
      
      Change-Id: Ifec0080c00eb1f94a8c02f8bf60b93308e71b119
      Reviewed-on: https://go-review.googlesource.com/c/151298
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      5680874e
    • Elias Naur's avatar
      cmd/link/internal/ld: omit deprecated linker argument for iOS builds · cfac65bf
      Elias Naur authored
      After CL 151139 introduced a plugin test, the macOS linker for iOS
      outputs:
      
      ld: warning: -flat_namespace is deprecated on iOS
      
      Omit the -flat_namespace flag on iOS; plugins are not supported on
      iOS, and unlikely to ever be.
      
      Change-Id: I2d08f8b984efcfd442d572b4a0f3a2c95c551b9f
      Reviewed-on: https://go-review.googlesource.com/c/151300
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      cfac65bf
    • Alex Brainman's avatar
      debug/pe: correct TestImportTableInUnknownSection error message · 22dbc96d
      Alex Brainman authored
      TestImportTableInUnknownSection uses kernel32.dll file, but the error
      message mentions atmfd.dll. Adjust error message to match the test.
      
      This change should have been part of CL 151137.
      
      Updates #27904
      
      Change-Id: Ifc31a12134b328472191122f8426ab6ed234fbd4
      Reviewed-on: https://go-review.googlesource.com/c/151477
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarTobias Klauser <tobias.klauser@gmail.com>
      22dbc96d
    • Alex Brainman's avatar
      cmd/link: do not use _GLOBAL_OFFSET_TABLE_ on windows/386 · 41fd4c88
      Alex Brainman authored
      When building windows/386 executable that imports "plugin" package,
      cmd/link adds reference to DLL with blank name. Running
      
      objdump -x a.exe
      
      reports
      
      ...
      The Import Tables (interpreted .idata section contents)
      ...
      DLL Name:
      vma:  Hint/Ord Member-Name Bound-To
      25308a     0  _GLOBAL_OFFSET_TABLE_
      ...
      
      So, obviously, executable cannot run, because Windows complains
      that it cannot find DLL when trying to run it.
      
      Stop using _GLOBAL_OFFSET_TABLE_ on windows/386.
      
      Fixes #28789
      
      Change-Id: Idd489eafd998f6e329f40c5d90a2a8965ab1d873
      Reviewed-on: https://go-review.googlesource.com/c/151139
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      41fd4c88
    • Bryan C. Mills's avatar
      cmd/go/internal/imports: resolve symlinks in ScanDir · 440368da
      Bryan C. Mills authored
      We were using the mode reported by ReadDir to decide whether each
      entry is a file, but in the case of symlinks that isn't sufficient: a
      symlink could point to either a file or a directory, and if it is a
      file we should treat it as such.
      
      Fixes #28107
      
      Change-Id: Icf6e495dce427a7b1124c9cc9f085e40a215c169
      Reviewed-on: https://go-review.googlesource.com/c/141097
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      440368da
    • Brian Kessler's avatar
      math/bits: define Div to panic when y<=hi · 979d9027
      Brian Kessler authored
      Div panics when y<=hi because either the quotient overflows
      the size of the output or division by zero occurs when y==0.
      This provides a uniform behavior for all implementations.
      
      Fixes #28316
      
      Change-Id: If23aeb10e0709ee1a60b7d614afc9103d674a980
      Reviewed-on: https://go-review.googlesource.com/c/149517Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      979d9027
    • Brian Kessler's avatar
      cmd/compile: intrinsify math/bits.Div on amd64 · 319787a5
      Brian Kessler authored
      Note that the intrinsic implementation panics separately for overflow and
      divide by zero, which matches the behavior of the pure go implementation.
      There is a modest performance improvement after intrinsic implementation.
      
      name     old time/op  new time/op  delta
      Div-4    53.0ns ± 1%  47.0ns ± 0%  -11.28%  (p=0.008 n=5+5)
      Div32-4  18.4ns ± 0%  18.5ns ± 1%     ~     (p=0.444 n=5+5)
      Div64-4  53.3ns ± 0%  47.5ns ± 4%  -10.77%  (p=0.008 n=5+5)
      
      Updates #28273
      
      Change-Id: Ic1688ecc0964acace2e91bf44ef16f5fb6b6bc82
      Reviewed-on: https://go-review.googlesource.com/c/144378
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      319787a5
    • Brian Kessler's avatar
      math/bits: panic when y<=hi in Div · ead5d1e3
      Brian Kessler authored
      Explicitly check for divide-by-zero/overflow and panic with the appropriate
      runtime error.  The additional checks have basically no effect on performance
      since the branch is easily predicted.
      
      name     old time/op  new time/op  delta
      Div-4    53.9ns ± 1%  53.0ns ± 1%  -1.59%  (p=0.016 n=4+5)
      Div32-4  17.9ns ± 0%  18.4ns ± 0%  +2.56%  (p=0.008 n=5+5)
      Div64-4  53.5ns ± 0%  53.3ns ± 0%    ~     (p=0.095 n=5+5)
      
      Updates #28316
      
      Change-Id: I36297ee9946cbbc57fefb44d1730283b049ecf57
      Reviewed-on: https://go-review.googlesource.com/c/144377
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      ead5d1e3
    • Keith Randall's avatar
      cmd/compile: don't convert non-Go-constants to OLITERALs · eb6c433e
      Keith Randall authored
      Don't convert values that aren't Go constants, like
      uintptr(unsafe.Pointer(nil)), to a literal constant. This avoids
      assuming they are constants for things like indexing, array sizes,
      case duplication, etc.
      
      Also, nil is an allowed duplicate in switches. CTNILs aren't Go constants.
      
      Fixes #28078
      Fixes #28079
      
      Change-Id: I9ab8af47098651ea09ef10481787eae2ae2fb445
      Reviewed-on: https://go-review.googlesource.com/c/151320
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      eb6c433e
  2. 26 Nov, 2018 13 commits
  3. 24 Nov, 2018 1 commit
    • Alex Brainman's avatar
      debug/pe: use kernel32.dll in TestImportTableInUnknownSection · 048c9164
      Alex Brainman authored
      TestImportTableInUnknownSection was introduced in CL 110555 to
      test PE executable with import table located in section other than
      ".idata". We used atmfd.dll for that purpose, but it seems
      atmfd.dll is not present on some systems.
      
      Use kernel32.dll instead. kernel32.dll import table is located in
      ".rdata" section, so it should do the job. And every Windows
      system has kernel32.dll file.
      
      Also make TestImportTableInUnknownSection run on windows-arm,
      since windows-arm should also have kernel32.dll file.
      
      Updates #27904
      
      Change-Id: Ie005ee10e46ae0c06e83929d581e89f86c051eea
      Reviewed-on: https://go-review.googlesource.com/c/151137
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      048c9164
  4. 23 Nov, 2018 4 commits
  5. 22 Nov, 2018 2 commits
  6. 21 Nov, 2018 8 commits
  7. 20 Nov, 2018 2 commits