1. 17 Sep, 2018 9 commits
    • fanzha02's avatar
      cmd/compile: optimize math.Float64(32)bits and math.Float64(32)frombits on arm64 · a19a83c8
      fanzha02 authored
      Use float <-> int register moves without conversion instead of stores
      and loads to move float <-> int values.
      
      Math package benchmark results.
      name                 old time/op  new time/op  delta
      Acosh                 153ns ± 0%   147ns ± 0%   -3.92%  (p=0.000 n=10+10)
      Asinh                 183ns ± 0%   177ns ± 0%   -3.28%  (p=0.000 n=10+10)
      Atanh                 157ns ± 0%   155ns ± 0%   -1.27%  (p=0.000 n=10+10)
      Atan2                 118ns ± 0%   117ns ± 1%   -0.59%  (p=0.003 n=10+10)
      Cbrt                  119ns ± 0%   114ns ± 0%   -4.20%  (p=0.000 n=10+10)
      Copysign             7.51ns ± 0%  6.51ns ± 0%  -13.32%  (p=0.000 n=9+10)
      Cos                  73.1ns ± 0%  70.6ns ± 0%   -3.42%  (p=0.000 n=10+10)
      Cosh                  119ns ± 0%   121ns ± 0%   +1.68%  (p=0.000 n=10+9)
      ExpGo                 154ns ± 0%   149ns ± 0%   -3.05%  (p=0.000 n=9+10)
      Expm1                 101ns ± 0%    99ns ± 0%   -1.88%  (p=0.000 n=10+10)
      Exp2Go                150ns ± 0%   146ns ± 0%   -2.67%  (p=0.000 n=10+10)
      Abs                  7.01ns ± 0%  6.01ns ± 0%  -14.27%  (p=0.000 n=10+9)
      Mod                   234ns ± 0%   212ns ± 0%   -9.40%  (p=0.000 n=9+10)
      Frexp                34.5ns ± 0%  30.0ns ± 0%  -13.04%  (p=0.000 n=10+10)
      Gamma                 112ns ± 0%   111ns ± 0%   -0.89%  (p=0.000 n=10+10)
      Hypot                73.6ns ± 0%  68.6ns ± 0%   -6.79%  (p=0.000 n=10+10)
      HypotGo              77.1ns ± 0%  72.1ns ± 0%   -6.49%  (p=0.000 n=10+10)
      Ilogb                31.0ns ± 0%  28.0ns ± 0%   -9.68%  (p=0.000 n=10+10)
      J0                    437ns ± 0%   434ns ± 0%   -0.62%  (p=0.000 n=10+10)
      J1                    433ns ± 0%   431ns ± 0%   -0.46%  (p=0.000 n=10+10)
      Jn                    927ns ± 0%   922ns ± 0%   -0.54%  (p=0.000 n=10+10)
      Ldexp                41.5ns ± 0%  37.0ns ± 0%  -10.84%  (p=0.000 n=9+10)
      Log                   124ns ± 0%   118ns ± 0%   -4.84%  (p=0.000 n=10+9)
      Logb                 34.0ns ± 0%  32.0ns ± 0%   -5.88%  (p=0.000 n=10+10)
      Log1p                 110ns ± 0%   108ns ± 0%   -1.82%  (p=0.000 n=10+10)
      Log10                 136ns ± 0%   132ns ± 0%   -2.94%  (p=0.000 n=10+10)
      Log2                 51.6ns ± 0%  47.1ns ± 0%   -8.72%  (p=0.000 n=10+10)
      Nextafter32          33.0ns ± 0%  30.5ns ± 0%   -7.58%  (p=0.000 n=10+10)
      Nextafter64          29.0ns ± 0%  26.5ns ± 0%   -8.62%  (p=0.000 n=10+10)
      PowInt                169ns ± 0%   160ns ± 0%   -5.33%  (p=0.000 n=10+10)
      PowFrac               375ns ± 0%   361ns ± 0%   -3.73%  (p=0.000 n=10+10)
      RoundToEven          14.0ns ± 0%  12.5ns ± 0%  -10.71%  (p=0.000 n=10+10)
      Remainder             206ns ± 0%   192ns ± 0%   -6.80%  (p=0.000 n=10+9)
      Signbit              6.01ns ± 0%  5.51ns ± 0%   -8.32%  (p=0.000 n=10+9)
      Sin                  70.1ns ± 0%  69.6ns ± 0%   -0.71%  (p=0.000 n=10+10)
      Sincos               99.1ns ± 0%  99.6ns ± 0%   +0.50%  (p=0.000 n=9+10)
      SqrtGoLatency         178ns ± 0%   146ns ± 0%  -17.70%  (p=0.000 n=8+10)
      SqrtPrime            9.19µs ± 0%  9.20µs ± 0%   +0.01%  (p=0.000 n=9+9)
      Tanh                  125ns ± 1%   127ns ± 0%   +1.36%  (p=0.000 n=10+10)
      Y0                    428ns ± 0%   426ns ± 0%   -0.47%  (p=0.000 n=10+10)
      Y1                    431ns ± 0%   429ns ± 0%   -0.46%  (p=0.000 n=10+9)
      Yn                    906ns ± 0%   901ns ± 0%   -0.55%  (p=0.000 n=10+10)
      Float64bits          4.50ns ± 0%  3.50ns ± 0%  -22.22%  (p=0.000 n=10+10)
      Float64frombits      4.00ns ± 0%  3.50ns ± 0%  -12.50%  (p=0.000 n=10+9)
      Float32bits          4.50ns ± 0%  3.50ns ± 0%  -22.22%  (p=0.002 n=8+10)
      Float32frombits      4.00ns ± 0%  3.50ns ± 0%  -12.50%  (p=0.000 n=10+10)
      
      Change-Id: Iba829e15d5624962fe0c699139ea783efeefabc2
      Reviewed-on: https://go-review.googlesource.com/129715Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a19a83c8
    • Hana Kim's avatar
      cmd/trace: don't drop sweep slice details · e57f24ab
      Hana Kim authored
      For sweep events, we used to modify the ViewerEvent returned from
      ctx.emitSlice later in order to embed more details about the sweep
      operation. The trick no longer works after the change
      https://golang.org/cl/92375 and caused a regression.
      
      ctx.emit method encodes the ViewerEvent, so any modification to the
      ViewerEvent object after ctx.emit returns will not be reflected.
      
      Refactor ctx.emitSlice, so ctx.makeSlice can be used when producing
      slices for SWEEP. ctx.emit* methods are meant to truely emit
      ViewerEvents.
      
      Fixes #27711
      
      Change-Id: I0b733ebbbfd4facd8714db0535809ec3cab0833d
      Reviewed-on: https://go-review.googlesource.com/135775Reviewed-by: default avatarAustin Clements <austin@google.com>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e57f24ab
    • Robert Griesemer's avatar
      go/types: fix a couple of internal comments · 8595868e
      Robert Griesemer authored
      Change-Id: If0e8fbb05c09ee7c64e1aa6b0aa2ade35a70df8a
      Reviewed-on: https://go-review.googlesource.com/135696Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      8595868e
    • Tobias Klauser's avatar
      syscall: enable TestSyscallNoError on all Linux 32-bit architectures · 5eec2373
      Tobias Klauser authored
      Check the size of uintptr instead of listing GOARCHes explicitly. This
      will make the test also run on linux/mips{,le}.
      
      Change-Id: I649f15d293002afc1360b1913910202c3e5188b7
      Reviewed-on: https://go-review.googlesource.com/135715
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5eec2373
    • Keith Randall's avatar
      cmd/compile: fix CMPconstload rule · 623c7728
      Keith Randall authored
      The CMPconstload opcodes take a ValAndOff as their AuxInt, not just
      an offset.
      
      Originally introduced in CL 135379.
      
      Change-Id: I244b2d56ef2e99d2975faa2e97f4291ec97c64b7
      Reviewed-on: https://go-review.googlesource.com/135418
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIlya Tocar <ilya.tocar@intel.com>
      623c7728
    • Bryan C. Mills's avatar
      cmd/go/testdata/script/mod_test: add missing test invocation for case e · 4c36bc3d
      Bryan C. Mills authored
      Change-Id: Ib0544adc1444a473f8edcb9dd92aefa9fcbc7330
      Reviewed-on: https://go-review.googlesource.com/134656Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4c36bc3d
    • Michael Munday's avatar
      cmd/compile: avoid more float32 <-> float64 conversions in compiler · 2db1a7f9
      Michael Munday authored
      Use the new custom truncate/extension code when storing or extracting
      float32 values from AuxInts to avoid the value being changed by the
      host platform's floating point conversion instructions (e.g. sNaN ->
      qNaN).
      
      Updates #27516.
      
      Change-Id: Id39650f1431ef74af088c895cf4738ea5fa87974
      Reviewed-on: https://go-review.googlesource.com/134855
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      2db1a7f9
    • Iskander Sharipov's avatar
      cmd/compile/internal/gc: handle array slice self-assign in esc.go · 859cf7fc
      Iskander Sharipov authored
      Instead of skipping all OSLICEARR, skip only ones with non-pointer
      array type. For pointers to arrays, it's safe to apply the
      self-assignment slicing optimizations.
      
      Refactored the matching code into separate function for readability.
      
      This is an extension to already existing optimization.
      
      On its own, it does not improve any code under std, but
      it opens some new optimization opportunities. One
      of them is described in the referenced issue.
      
      Updates #7921
      
      Change-Id: I08ac660d3ef80eb15fd7933fb73cf53ded9333ad
      Reviewed-on: https://go-review.googlesource.com/133375
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      859cf7fc
    • Iskander Sharipov's avatar
      cmd/compile/internal/gc: treat cap/len as safe in mayAffectMemory · 2d82465d
      Iskander Sharipov authored
      OLEN and OCAP can't affect memory state as long as their
      arguments don't.
      
      Re-organized case bodies to avoid duplicating same branches for
      recursive invocations.
      
      Change-Id: I30407143429f7dd1891badb70df88969ed267535
      Reviewed-on: https://go-review.googlesource.com/133555
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      2d82465d
  2. 16 Sep, 2018 3 commits
  3. 15 Sep, 2018 3 commits
  4. 14 Sep, 2018 6 commits
  5. 13 Sep, 2018 14 commits
    • Ian Lance Taylor's avatar
      path/filepath: correct symlink eval for symlink at root · 9f59918c
      Ian Lance Taylor authored
      For a relative symlink in the root directory, such as /tmp ->
      private/tmp, we were dropping the leading slash.
      
      No test because we can't create a symlink in the root directory.
      The test TestGZIPFilesHaveZeroMTimes was failing on the Darwin builders.
      
      Updates #19922
      Updates #20506
      
      Change-Id: Ic83cb6d97ad0cb628fc551ac772a44fb3e20f038
      Reviewed-on: https://go-review.googlesource.com/135295
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      9f59918c
    • David du Colombier's avatar
      runtime: don't build semasleep_test on Plan 9 · 7c95703c
      David du Colombier authored
      CL 135015 added TestSpuriousWakeupsNeverHangSemasleep.
      However, this test is failing on Plan 9 because
      syscall.SIGIO is not defined.
      
      This change excludes semasleep_test.go on Plan 9
      
      Fixes #27662.
      
      Change-Id: I52f9f0fe9ec3c70da5d2f586a95debbc1fe568a1
      Reviewed-on: https://go-review.googlesource.com/135315
      Run-TryBot: David du Colombier <0intro@gmail.com>
      Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7c95703c
    • Roberto Selbach's avatar
      cmd/go/internal/modfetch: stop cutting the last character of versions · 56dc1795
      Roberto Selbach authored
      When a zip archive for a module contains an unexpected file, the error
      message removes the last character in the version number, e.g. an invalid
      archive for "somemod@v1.2.3" would generate the following error:
      "zip for somemod@1.2. has unexpected file..."
      
      Change-Id: I366622df16a71fa7467a4bc62cb696e3e83a2942
      GitHub-Last-Rev: f172283bcdffd45b485b1e8fd99795eb93fef726
      GitHub-Pull-Request: golang/go#27279
      Reviewed-on: https://go-review.googlesource.com/131635
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      56dc1795
    • Lynn Boger's avatar
      cmd/compile: improve rules for PPC64.rules · 8dbd9afb
      Lynn Boger authored
      This adds some improvements to the rules for PPC64 to eliminate
      unnecessary zero or sign extends, and fix some rule for truncates
      which were not always using the correct sign instruction.
      
      This reduces of size of many functions by 1 or 2 instructions and
      can improve performance in cases where the execution time depends
      on small loops where at least 1 instruction was removed and where that
      loop contributes a significant amount of the total execution time.
      
      Included is a testcase for codegen to verify the sign/zero extend
      instructions are omitted.
      
      An example of the improvement (strings):
      IndexAnyASCII/256:1-16     392ns ± 0%   369ns ± 0%  -5.79%  (p=0.000 n=1+10)
      IndexAnyASCII/256:2-16     397ns ± 0%   376ns ± 0%  -5.23%  (p=0.000 n=1+9)
      IndexAnyASCII/256:4-16     405ns ± 0%   384ns ± 0%  -5.19%  (p=1.714 n=1+6)
      IndexAnyASCII/256:8-16     427ns ± 0%   403ns ± 0%  -5.57%  (p=0.000 n=1+10)
      IndexAnyASCII/256:16-16    441ns ± 0%   418ns ± 1%  -5.33%  (p=0.000 n=1+10)
      IndexAnyASCII/4096:1-16   5.62µs ± 0%  5.27µs ± 1%  -6.31%  (p=0.000 n=1+10)
      IndexAnyASCII/4096:2-16   5.67µs ± 0%  5.29µs ± 0%  -6.67%  (p=0.222 n=1+8)
      IndexAnyASCII/4096:4-16   5.66µs ± 0%  5.28µs ± 1%  -6.66%  (p=0.000 n=1+10)
      IndexAnyASCII/4096:8-16   5.66µs ± 0%  5.31µs ± 1%  -6.10%  (p=0.000 n=1+10)
      IndexAnyASCII/4096:16-16  5.70µs ± 0%  5.33µs ± 1%  -6.43%  (p=0.182 n=1+10)
      
      Change-Id: I739a6132b505936d39001aada5a978ff2a5f0500
      Reviewed-on: https://go-review.googlesource.com/129875Reviewed-by: default avatarDavid Chase <drchase@google.com>
      8dbd9afb
    • Robert Griesemer's avatar
      go/types: be more precise in API comment · 8eb36ae9
      Robert Griesemer authored
      Change-Id: I24c4b08091bf3b8734f5dcdb9eac1a3582a4daa8
      Reviewed-on: https://go-review.googlesource.com/135116Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      8eb36ae9
    • Robert Griesemer's avatar
      go/types: fix scope printing (debugging support) · 8e2333b2
      Robert Griesemer authored
      Printing of scopes was horribly wrong: If a scope contained
      no object declarations, it would abort printing even if the
      scope had children scopes. Also, the line breaks were not
      inserted consistently. The actual test case (ExampleScope)
      was incorrect as well.
      
      Fixed and simplified printing, and adjusted example which
      tests the printing output.
      
      Change-Id: If21c1d4ad71b15a517d4a54da16de5e6228eb4b5
      Reviewed-on: https://go-review.googlesource.com/135115
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      8e2333b2
    • erifan01's avatar
      runtime: skip TestGcSys on arm64 · 0ef42f4d
      erifan01 authored
      This failure occurs randomly on arm64.
      
      13:10:32 --- FAIL: TestGcSys (0.06s)
      13:10:32 gc_test.go:30: expected "OK\n", but got "using too much memory: 71401472 bytes\n"
      13:10:32 FAIL
      
      Updates #27636
      
      Change-Id: Ifd4cfce167d8054dc6f037bd34368d63c7f68ed4
      Reviewed-on: https://go-review.googlesource.com/135155
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      0ef42f4d
    • Ian Lance Taylor's avatar
      path/filepath: rewrite walkSymlinks · 7d27e87d
      Ian Lance Taylor authored
      Rather than try to work around Clean and Join on intermediate steps,
      which can remove ".." components unexpectedly, just do everything in
      walkSymlinks. Use a single loop over path components.
      
      Fixes #23444
      
      Change-Id: I4f15e50d0df32349cc4fd55e3d224ec9ab064379
      Reviewed-on: https://go-review.googlesource.com/121676
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      7d27e87d
    • Alan Donovan's avatar
      regexp: fix incorrect name in Match doc comment · 8c610aa6
      Alan Donovan authored
      Change-Id: I628aad9a3abe9cc0c3233f476960e53bd291eca9
      Reviewed-on: https://go-review.googlesource.com/135235Reviewed-by: default avatarRalph Corderoy <ralph@inputplus.co.uk>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      8c610aa6
    • erifan01's avatar
      strings, bytes: optimize function Index · 691f5c34
      erifan01 authored
      This change compares the first two characters instead of the first one,
      and if they match, the entire string is compared. Comparing the first two
      characters helps to filter out the case where the first character matches
      but the subsequent characters do not match, thereby improving the substring
      search speed in this case.
      
      Benchmarks with no effect or minimal impact (less than 5%) is not listed,
      the following are improved benchmarks:
      On arm64:
      strings:
      IndexPeriodic/IndexPeriodic16-8   172890.00ns +- 2%   124156.20ns +- 0%  -28.19%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic32-8    78092.80ns +- 0%    65138.60ns +- 0%  -16.59%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic64-8    42322.20ns +- 0%    34661.60ns +- 0%  -18.10%  (p=0.008 n=5+5)
      bytes:
      IndexPeriodic/IndexPeriodic16-8     183468.20ns +- 6%     123759.00ns +- 0%  -32.54%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic32-8      84776.40ns +- 0%      63907.80ns +- 0%  -24.62%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic64-8      45835.60ns +- 0%      34194.20ns +- 0%  -25.40%  (p=0.008 n=5+5)
      
      On amd64:
      strings:
      IndexPeriodic/IndexPeriodic8-16    219499.00ns +- 0%   178123.40ns +- 0%  -18.85%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic16-16   109760.20ns +- 0%    88957.80ns +- 0%  -18.95%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic32-16    54943.00ns +- 0%    44573.80ns +- 0%  -18.87%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic64-16    29804.80ns +- 0%    24417.80ns +- 0%  -18.07%  (p=0.008 n=5+5)
      bytes:
      IndexPeriodic/IndexPeriodic8-16     226592.60ns +- 0%    181183.20ns +- 0%  -20.04%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic16-16    111432.60ns +- 0%     90634.60ns +- 0%  -18.66%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic32-16     55640.60ns +- 0%     45433.00ns +- 0%  -18.35%  (p=0.008 n=5+5)
      IndexPeriodic/IndexPeriodic64-16     30833.00ns +- 0%     24784.20ns +- 0%  -19.62%  (p=0.008 n=5+5)
      
      Change-Id: I2d9e7e138d29e960d20a203eb74dc2ec976a9d71
      Reviewed-on: https://go-review.googlesource.com/131177
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      691f5c34
    • Robert Griesemer's avatar
      cmd/vet: avoid internal error for implicitly declared type switch vars · 77e503a3
      Robert Griesemer authored
      For type switches using a short variable declaration of the form
      
         switch t := x.(type) {
         case T1:
         ...
      
      go/types doesn't declare the symbolic variable (t in this example)
      with the switch; thus such variables are not found in types.Info.Defs.
      
      Instead they are implicitly declared with each type switch case,
      and can be found in types.Info.Implicits.
      
      Adjust the shadowing code accordingly.
      
      Added a test case to verify that the issue is fixed, and a test
      case verifying that the shadowing code now considers implicitly
      declared variables introduces in type switch cases.
      
      While at it, also fixed the (internal) error reporting to provide
      more accurate information.
      
      Fixe #26725.
      
      Change-Id: If408ed9e692bf47c640f81de8f46bf5eb43415b0
      Reviewed-on: https://go-review.googlesource.com/135117
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      77e503a3
    • erifan01's avatar
      cmd/compile: intrinsify math.RoundToEven and math.Abs on arm64 · 8149db4f
      erifan01 authored
      math.RoundToEven can be done by one arm64 instruction FRINTND, intrinsify it to improve performance.
      The current pure Go implementation of the function Abs is translated into five instructions on arm64:
      str, ldr, and, str, ldr. The intrinsic implementation requires only one instruction, so in terms of
      performance, intrinsify it is worthwhile.
      
      Benchmarks:
      name           old time/op  new time/op  delta
      Abs-8          3.50ns ± 0%  1.50ns ± 0%  -57.14%  (p=0.000 n=10+10)
      RoundToEven-8  9.26ns ± 0%  1.50ns ± 0%  -83.80%  (p=0.000 n=10+10)
      
      Change-Id: I9456b26ab282b544dfac0154fc86f17aed96ac3d
      Reviewed-on: https://go-review.googlesource.com/116535Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8149db4f
    • Tobias Klauser's avatar
      os: add ModeCharDevice to ModeType · a2a3dd00
      Tobias Klauser authored
      When masking FileInfo.Mode() from a character device with the ModeType
      mask, ModeCharDevice cannot be recovered.
      
      ModeCharDevice was added https://golang.org/cl/5531052, but nothing
      indicates why it was omitted from ModeType. Add it now.
      
      Fixes #27640
      
      Change-Id: I52f56108b88b1b0a5bc6085c66c3c67e10600619
      Reviewed-on: https://go-review.googlesource.com/135075
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      a2a3dd00
    • Emmanuel T Odeke's avatar
      runtime: regression test for semasleep indefinite hang · 1b937445
      Emmanuel T Odeke authored
      A regression test in which: for a program that invokes semasleep,
      we send non-terminal signals such as SIGIO.
      Since the signal wakes up pthread_cond_timedwait_relative_np,
      after CL 133655, we should only re-spin for the amount of
      time left, instead of re-spinning with the original duration
      which would cause an indefinite spin.
      
      Updates #27520
      
      Change-Id: I744a6d04cf8923bc4e13649446aff5e42b7de5d8
      Reviewed-on: https://go-review.googlesource.com/135015
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      1b937445
  6. 12 Sep, 2018 5 commits
    • erifan01's avatar
      internal/bytealg: optimize Equal on arm64 · de28555c
      erifan01 authored
      Currently the 16-byte loop chunk16_loop is implemented with NEON instructions LD1, VMOV and VCMEQ.
      Using scalar instructions LDP and CMP to achieve this loop can reduce the number of clock cycles.
      For cases where the length of strings are between 4 to 15 bytes, loading the last 8 or 4 bytes at
      a time to reduce the number of comparisons.
      
      Benchmarks:
      name                 old time/op    new time/op    delta
      Equal/0-8              5.51ns ± 0%    5.84ns ±14%     ~     (p=0.246 n=7+8)
      Equal/1-8              10.5ns ± 0%    10.5ns ± 0%     ~     (all equal)
      Equal/6-8              14.0ns ± 0%    12.5ns ± 0%  -10.71%  (p=0.000 n=8+8)
      Equal/9-8              13.5ns ± 0%    12.5ns ± 0%   -7.41%  (p=0.000 n=8+8)
      Equal/15-8             15.5ns ± 0%    12.5ns ± 0%  -19.35%  (p=0.000 n=8+8)
      Equal/16-8             14.0ns ± 0%    13.0ns ± 0%   -7.14%  (p=0.000 n=8+8)
      Equal/20-8             16.5ns ± 0%    16.0ns ± 0%   -3.03%  (p=0.000 n=8+8)
      Equal/32-8             16.5ns ± 0%    15.3ns ± 0%   -7.27%  (p=0.000 n=8+8)
      Equal/4K-8              552ns ± 0%     553ns ± 0%     ~     (p=0.315 n=8+8)
      Equal/4M-8             1.13ms ±23%    1.20ms ±27%     ~     (p=0.442 n=8+8)
      Equal/64M-8            32.9ms ± 0%    32.6ms ± 0%   -1.15%  (p=0.000 n=8+8)
      CompareBytesEqual-8    12.0ns ± 0%    12.0ns ± 0%     ~     (all equal)
      
      Change-Id: If317ecdcc98e31883d37fd7d42b113b548c5bd2a
      Reviewed-on: https://go-review.googlesource.com/112496Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      de28555c
    • Bryan C. Mills's avatar
      cmd/go: avoid type names in __debug__modinfo__ variable injected in package main · 21f3d581
      Bryan C. Mills authored
      If we use the name 'string' to refer to the built-in type, that name
      can be shadowed by a local declaration. Use a string constant instead,
      but keep the init function to populate it so that //go:linkname will
      still work properly.
      
      Fixes #27584.
      
      Change-Id: I850cad6663e566f70fd123107d2e4e742c93b450
      Reviewed-on: https://go-review.googlesource.com/134915Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      21f3d581
    • Tobias Klauser's avatar
      runtime: use functions from mem_bsd.go on Darwin · b07f60b9
      Tobias Klauser authored
      The implementations of the functions in mem_darwin.go is identical to
      the ones defined in mem_bsd.go for all other BSD-like GOOSes. Also use
      them on Darwin.
      
      Change-Id: Ie7c170c1a50666475e79599471081cd85f0837ad
      Reviewed-on: https://go-review.googlesource.com/134875
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b07f60b9
    • Tobias Klauser's avatar
      cmd/dist: make raceDetectorSupported an exact copy of cmd/internal/sys.RaceDetectorSupported · c56dcd5f
      Tobias Klauser authored
      The comment states that cmd/internal/sys.RaceDetectorSupported is a copy,
      so make the two identical. No functional difference, since ppce64le is
      only supported on linux anyway.
      
      Change-Id: Id3e4d445fb700b9b3bb53bf15ea05b8911b4f95e
      Reviewed-on: https://go-review.googlesource.com/134595
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c56dcd5f
    • Emmanuel T Odeke's avatar
      runtime: convert initial timediv quotient increments to bitsets · 178a609f
      Emmanuel T Odeke authored
      At the very beginning of timediv, inside a for loop,
      we reduce the base value by at most (1<<31)-1, while
      incrementing the quotient result by 1<<uint(bit).
      However, since the quotient value was 0 to begin with,
      we are essentially just doing bitsets.
      
      This change is in the hot path of various concurrency and
      scheduling operations that require sleeping, waiting
      on mutexes and futexes etc. On the following OSes:
      * Dragonfly
      * FreeBSD
      * Linux
      * NetBSD
      * OpenBSD
      * Plan9
      * Windows
      
      and paired with architectures that provide the BTS instruction, this
      change shaves off a couple of nanoseconds per invocation of timediv.
      
      Fixes #27529
      
      Change-Id: Ia2fea5022c1109e02d86d1f962a3b0bd70967aa6
      Reviewed-on: https://go-review.googlesource.com/134231
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      178a609f