1. 01 Mar, 2018 1 commit
    • Joe Tsai's avatar
      encoding/json: avoid assuming side-effect free reflect.Value.Addr().Elem() · 4338518d
      Joe Tsai authored
      Consider the following:
      	type child struct{ Field string }
      	type parent struct{ child }
      
      	p := new(parent)
      	v := reflect.ValueOf(p).Elem().Field(0)
      	v.Field(0).SetString("hello")           // v.Field = "hello"
      	v = v.Addr().Elem()                     // v = *(&v)
      	v.Field(0).SetString("goodbye")         // v.Field = "goodbye"
      
      It would appear that v.Addr().Elem() should have the same value, and
      that it would be safe to set "goodbye".
      However, after CL 66331, any interspersed calls between Field calls
      causes the RO flag to be set.
      Thus, setting to "goodbye" actually causes a panic.
      
      That CL affects decodeState.indirect which assumes that back-to-back
      Value.Addr().Elem() is side-effect free. We fix that logic to keep
      track of the Addr() and Elem() calls and set v back to the original
      after a full round-trip has occured.
      
      Fixes #24152
      Updates #24153
      
      Change-Id: Ie50f8fe963f00cef8515d89d1d5cbc43b76d9f9c
      Reviewed-on: https://go-review.googlesource.com/97796Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4338518d
  2. 28 Feb, 2018 17 commits
    • erifan01's avatar
      cmd/asm: enable several arm64 load & store instructions · 8c3c8332
      erifan01 authored
      Instructions LDARB, LDARH, LDAXPW, LDAXP, STLRB, STLRH, STLXP, STLXPW, STXP,
      STXPW have been added before, but they are not enabled. This CL enabled them.
      
      Change the form of LDXP and LDXPW to the form of LDP, and fix a bug of STLXP.
      
      Change-Id: I5d2b51494b92451bf6b072c65cfdd8acf07e9b54
      Reviewed-on: https://go-review.googlesource.com/96215
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      8c3c8332
    • Ben Shi's avatar
      cmd/compile: optimize ARM64 code with EON/ORN · 10576249
      Ben Shi authored
      EON and ORN are efficient ARM64 instructions. EON combines (x ^ ^y)
      into a single operation, and so ORN does for (x | ^y).
      
      This CL implements that optimization. And here are benchmark results
      with RaspberryPi3/ArchLinux.
      
      1. A specific test gets about 13% improvement.
      EONORN                      181µs ± 0%     157µs ± 0%  -13.26%  (p=0.000 n=26+23)
      (https://github.com/benshi001/ugo1/blob/master/eonorn_test.go)
      
      2. There is little change in the go1 benchmark, excluding noise.
      name                     old time/op    new time/op    delta
      BinaryTree17-4              44.1s ± 2%     44.0s ± 2%    ~     (p=0.513 n=30+30)
      Fannkuch11-4                32.9s ± 3%     32.8s ± 3%  -0.12%  (p=0.024 n=30+30)
      FmtFprintfEmpty-4           561ns ± 9%     558ns ± 9%    ~     (p=0.654 n=30+30)
      FmtFprintfString-4         1.09µs ± 4%    1.09µs ± 3%    ~     (p=0.158 n=30+30)
      FmtFprintfInt-4            1.12µs ± 0%    1.12µs ± 0%    ~     (p=0.917 n=23+28)
      FmtFprintfIntInt-4         1.73µs ± 0%    1.76µs ± 4%    ~     (p=0.665 n=23+30)
      FmtFprintfPrefixedInt-4    2.15µs ± 1%    2.15µs ± 0%    ~     (p=0.389 n=27+26)
      FmtFprintfFloat-4          3.18µs ± 4%    3.13µs ± 0%  -1.50%  (p=0.003 n=30+23)
      FmtManyArgs-4              7.32µs ± 4%    7.21µs ± 0%    ~     (p=0.220 n=30+25)
      GobDecode-4                99.1ms ± 9%    97.0ms ± 0%  -2.07%  (p=0.000 n=30+23)
      GobEncode-4                83.3ms ± 3%    82.4ms ± 4%    ~     (p=0.321 n=30+30)
      Gzip-4                      4.39s ± 4%     4.32s ± 2%  -1.42%  (p=0.017 n=30+23)
      Gunzip-4                    440ms ± 0%     447ms ± 4%  +1.54%  (p=0.006 n=24+30)
      HTTPClientServer-4          547µs ± 1%     537µs ± 1%  -1.91%  (p=0.000 n=30+30)
      JSONEncode-4                211ms ± 0%     211ms ± 0%  +0.04%  (p=0.000 n=23+24)
      JSONDecode-4                847ms ± 0%     847ms ± 0%    ~     (p=0.158 n=25+25)
      Mandelbrot200-4            46.5ms ± 0%    46.5ms ± 0%  -0.04%  (p=0.000 n=25+24)
      GoParse-4                  43.4ms ± 0%    43.4ms ± 0%    ~     (p=0.494 n=24+25)
      RegexpMatchEasy0_32-4      1.03µs ± 0%    1.03µs ± 0%    ~     (all equal)
      RegexpMatchEasy0_1K-4      4.02µs ± 3%    3.98µs ± 0%  -0.95%  (p=0.003 n=30+24)
      RegexpMatchEasy1_32-4      1.01µs ± 3%    1.01µs ± 2%    ~     (p=0.629 n=30+30)
      RegexpMatchEasy1_1K-4      6.39µs ± 0%    6.39µs ± 0%    ~     (p=0.564 n=24+23)
      RegexpMatchMedium_32-4     1.80µs ± 3%    1.78µs ± 0%    ~     (p=0.155 n=30+24)
      RegexpMatchMedium_1K-4      555µs ± 0%     563µs ± 3%  +1.55%  (p=0.004 n=27+30)
      RegexpMatchHard_32-4       31.0µs ± 4%    30.5µs ± 1%  -1.58%  (p=0.000 n=30+23)
      RegexpMatchHard_1K-4        947µs ± 4%     931µs ± 0%  -1.66%  (p=0.009 n=30+24)
      Revcomp-4                   7.71s ± 4%     7.71s ± 4%    ~     (p=0.196 n=29+30)
      Template-4                  877ms ± 0%     878ms ± 0%  +0.16%  (p=0.018 n=23+27)
      TimeParse-4                4.75µs ± 1%    4.74µs ± 0%    ~     (p=0.895 n=24+23)
      TimeFormat-4               4.83µs ± 4%    4.83µs ± 4%    ~     (p=0.767 n=30+30)
      [Geo mean]                  709µs          707µs       -0.35%
      
      name                     old speed      new speed      delta
      GobDecode-4              7.75MB/s ± 8%  7.91MB/s ± 0%  +2.03%  (p=0.001 n=30+23)
      GobEncode-4              9.22MB/s ± 3%  9.32MB/s ± 4%    ~     (p=0.389 n=30+30)
      Gzip-4                   4.43MB/s ± 4%  4.43MB/s ± 4%    ~     (p=0.888 n=30+30)
      Gunzip-4                 44.1MB/s ± 0%  43.4MB/s ± 4%  -1.46%  (p=0.009 n=24+30)
      JSONEncode-4             9.18MB/s ± 0%  9.18MB/s ± 0%    ~     (p=0.308 n=16+24)
      JSONDecode-4             2.29MB/s ± 0%  2.29MB/s ± 0%    ~     (all equal)
      GoParse-4                1.33MB/s ± 0%  1.33MB/s ± 0%    ~     (all equal)
      RegexpMatchEasy0_32-4    30.9MB/s ± 0%  30.9MB/s ± 0%    ~     (p=1.000 n=23+24)
      RegexpMatchEasy0_1K-4     255MB/s ± 3%   257MB/s ± 0%  +0.92%  (p=0.004 n=30+24)
      RegexpMatchEasy1_32-4    31.7MB/s ± 3%  31.6MB/s ± 2%    ~     (p=0.603 n=30+30)
      RegexpMatchEasy1_1K-4     160MB/s ± 0%   160MB/s ± 0%    ~     (p=0.435 n=24+23)
      RegexpMatchMedium_32-4    554kB/s ± 3%   560kB/s ± 0%  +1.08%  (p=0.004 n=30+24)
      RegexpMatchMedium_1K-4   1.85MB/s ± 0%  1.82MB/s ± 3%  -1.48%  (p=0.001 n=27+30)
      RegexpMatchHard_32-4     1.03MB/s ± 4%  1.05MB/s ± 1%  +1.51%  (p=0.027 n=30+23)
      RegexpMatchHard_1K-4     1.08MB/s ± 4%  1.10MB/s ± 0%  +1.69%  (p=0.002 n=30+25)
      Revcomp-4                33.0MB/s ± 4%  33.0MB/s ± 4%    ~     (p=0.272 n=29+30)
      Template-4               2.21MB/s ± 0%  2.21MB/s ± 0%    ~     (all equal)
      [Geo mean]               7.75MB/s       7.77MB/s       +0.29%
      
      3. There is little regression in the compilecmp benchmark.
      name        old time/op       new time/op       delta
      Template          2.28s ± 3%        2.28s ± 4%    ~     (p=0.739 n=10+10)
      Unicode           1.34s ± 4%        1.32s ± 3%    ~     (p=0.113 n=10+9)
      GoTypes           8.10s ± 3%        8.18s ± 3%    ~     (p=0.393 n=10+10)
      Compiler          39.0s ± 3%        39.2s ± 3%    ~     (p=0.393 n=10+10)
      SSA                114s ± 3%         115s ± 2%    ~     (p=0.631 n=10+10)
      Flate             1.41s ± 2%        1.42s ± 3%    ~     (p=0.353 n=10+10)
      GoParser          1.81s ± 1%        1.83s ± 2%    ~     (p=0.211 n=10+9)
      Reflect           5.06s ± 2%        5.06s ± 2%    ~     (p=0.912 n=10+10)
      Tar               2.19s ± 3%        2.20s ± 3%    ~     (p=0.247 n=10+10)
      XML               2.65s ± 2%        2.67s ± 5%    ~     (p=0.796 n=10+10)
      [Geo mean]        4.92s             4.93s       +0.27%
      
      name        old user-time/op  new user-time/op  delta
      Template          2.81s ± 2%        2.81s ± 3%    ~     (p=0.971 n=10+10)
      Unicode           1.70s ± 3%        1.67s ± 5%    ~     (p=0.315 n=10+10)
      GoTypes           9.71s ± 1%        9.78s ± 1%  +0.71%  (p=0.023 n=10+10)
      Compiler          47.3s ± 1%        47.1s ± 3%    ~     (p=0.579 n=10+10)
      SSA                143s ± 2%         143s ± 2%    ~     (p=0.280 n=10+10)
      Flate             1.70s ± 3%        1.71s ± 3%    ~     (p=0.481 n=10+10)
      GoParser          2.21s ± 3%        2.21s ± 1%    ~     (p=0.549 n=10+9)
      Reflect           5.89s ± 1%        5.87s ± 2%    ~     (p=0.739 n=10+10)
      Tar               2.66s ± 2%        2.63s ± 2%    ~     (p=0.105 n=10+10)
      XML               3.16s ± 3%        3.18s ± 2%    ~     (p=0.143 n=10+10)
      [Geo mean]        5.97s             5.97s       -0.06%
      
      name        old text-bytes    new text-bytes    delta
      HelloSize         637kB ± 0%        637kB ± 0%    ~     (all equal)
      
      name        old data-bytes    new data-bytes    delta
      HelloSize        9.46kB ± 0%       9.46kB ± 0%    ~     (all equal)
      
      name        old bss-bytes     new bss-bytes     delta
      HelloSize         125kB ± 0%        125kB ± 0%    ~     (all equal)
      
      name        old exe-bytes     new exe-bytes     delta
      HelloSize        1.24MB ± 0%       1.24MB ± 0%    ~     (all equal)
      
      Change-Id: Ie27357d65c5ce9d07afdffebe1e2daadcaa3369f
      Reviewed-on: https://go-review.googlesource.com/97036Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      10576249
    • Balaram Makam's avatar
      cmd/compile: improve fractional word zeroing · 09425840
      Balaram Makam authored
      This change improves fractional word zeroing by
      using overlapping MOVDs for the fractions.
      
      Performance of go1 benchmarks on Amberwing was all noise:
      name                   old time/op    new time/op    delta
      RegexpMatchEasy0_32       247ns ± 0%     246ns ± 0%  -0.40%  (p=0.008 n=5+5)
      RegexpMatchEasy0_1K       581ns ± 0%     579ns ± 0%  -0.34%  (p=0.000 n=5+4)
      RegexpMatchEasy1_32       244ns ± 0%     242ns ± 0%    ~     (p=0.079 n=4+5)
      RegexpMatchEasy1_1K       804ns ± 0%     805ns ± 0%    ~     (p=0.238 n=5+4)
      RegexpMatchMedium_32      313ns ± 0%     311ns ± 0%  -0.64%  (p=0.008 n=5+5)
      RegexpMatchMedium_1K     52.2µs ± 0%    51.9µs ± 0%  -0.52%  (p=0.016 n=5+4)
      RegexpMatchHard_32       2.75µs ± 0%    2.74µs ± 0%    ~     (p=0.603 n=5+5)
      RegexpMatchHard_1K       78.8µs ± 0%    78.9µs ± 0%  +0.05%  (p=0.008 n=5+5)
      FmtFprintfEmpty          58.6ns ± 0%    58.6ns ± 0%    ~     (p=0.159 n=5+5)
      FmtFprintfString          118ns ± 0%     119ns ± 0%  +0.85%  (p=0.008 n=5+5)
      FmtFprintfInt             119ns ± 0%     123ns ± 0%  +3.36%  (p=0.016 n=5+4)
      FmtFprintfIntInt          192ns ± 0%     200ns ± 0%  +4.17%  (p=0.008 n=5+5)
      FmtFprintfPrefixedInt     224ns ± 0%     209ns ± 0%  -6.70%  (p=0.008 n=5+5)
      FmtFprintfFloat           335ns ± 0%     335ns ± 0%    ~     (all equal)
      FmtManyArgs               775ns ± 0%     811ns ± 1%  +4.67%  (p=0.016 n=4+5)
      Gzip                      437ms ± 0%     438ms ± 0%  +0.19%  (p=0.008 n=5+5)
      HTTPClientServer         88.7µs ± 1%    90.3µs ± 1%  +1.75%  (p=0.016 n=5+5)
      JSONEncode               20.1ms ± 1%    20.1ms ± 0%    ~     (p=1.000 n=5+5)
      JSONDecode               94.7ms ± 1%    94.8ms ± 1%    ~     (p=0.548 n=5+5)
      GobDecode                12.8ms ± 1%    12.8ms ± 1%    ~     (p=0.548 n=5+5)
      GobEncode                12.1ms ± 0%    12.1ms ± 0%    ~     (p=0.151 n=5+5)
      Mandelbrot200            5.37ms ± 0%    5.37ms ± 0%  -0.03%  (p=0.008 n=5+5)
      TimeParse                 450ns ± 0%     451ns ± 1%    ~     (p=0.635 n=4+5)
      TimeFormat                485ns ± 0%     484ns ± 0%    ~     (p=0.508 n=5+5)
      Template                 90.4ms ± 0%    90.2ms ± 0%  -0.24%  (p=0.016 n=5+5)
      GoParse                  5.98ms ± 0%    5.98ms ± 0%    ~     (p=1.000 n=5+5)
      BinaryTree17              11.8s ± 0%     11.8s ± 0%    ~     (p=0.841 n=5+5)
      Revcomp                   669ms ± 0%     669ms ± 0%    ~     (p=0.310 n=5+5)
      Fannkuch11                3.28s ± 0%     3.34s ± 0%  +1.64%  (p=0.008 n=5+5)
      
      name                   old speed      new speed      delta
      RegexpMatchEasy0_32     129MB/s ± 0%   130MB/s ± 0%  +0.30%  (p=0.016 n=4+5)
      RegexpMatchEasy0_1K    1.76GB/s ± 0%  1.77GB/s ± 0%  +0.27%  (p=0.016 n=5+4)
      RegexpMatchEasy1_32     131MB/s ± 0%   132MB/s ± 0%  +0.71%  (p=0.016 n=4+5)
      RegexpMatchEasy1_1K    1.27GB/s ± 0%  1.27GB/s ± 0%  -0.17%  (p=0.016 n=5+4)
      RegexpMatchMedium_32   3.19MB/s ± 0%  3.21MB/s ± 0%  +0.63%  (p=0.008 n=5+5)
      RegexpMatchMedium_1K   19.6MB/s ± 0%  19.7MB/s ± 0%  +0.52%  (p=0.016 n=5+4)
      RegexpMatchHard_32     11.7MB/s ± 0%  11.7MB/s ± 0%    ~     (p=0.643 n=5+5)
      RegexpMatchHard_1K     13.0MB/s ± 0%  13.0MB/s ± 0%    ~     (p=0.079 n=4+5)
      Gzip                   44.4MB/s ± 0%  44.3MB/s ± 0%  -0.19%  (p=0.008 n=5+5)
      JSONEncode             96.3MB/s ± 1%  96.4MB/s ± 0%    ~     (p=1.000 n=5+5)
      JSONDecode             20.5MB/s ± 1%  20.5MB/s ± 1%    ~     (p=0.460 n=5+5)
      GobDecode              60.1MB/s ± 1%  59.9MB/s ± 1%    ~     (p=0.548 n=5+5)
      GobEncode              63.5MB/s ± 0%  63.7MB/s ± 0%    ~     (p=0.135 n=5+5)
      Template               21.5MB/s ± 0%  21.5MB/s ± 0%  +0.24%  (p=0.016 n=5+5)
      GoParse                9.68MB/s ± 0%  9.69MB/s ± 0%    ~     (p=0.786 n=5+5)
      Revcomp                 380MB/s ± 0%   380MB/s ± 0%    ~     (p=0.310 n=5+5)
      Change-Id: I596eee6421cdbad1a0189cdb9fe0628bba534eaf
      Reviewed-on: https://go-review.googlesource.com/96775Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      09425840
    • Hana Kim's avatar
      cmd/trace: skip tests if parsing fails with timestamp error · 413d8a83
      Hana Kim authored
      runtime/trace test already skips tests in case of the timestamp
      error.
      
      Moreover, relax TestAnalyzeAnnotationGC test condition to
      deal with the inaccuracy caused from use of cputicks in tracing.
      
      Fixes #24081
      Updates #16755
      
      Change-Id: I708ecc6da202eaec07e431085a75d3dbfbf4cc06
      Reviewed-on: https://go-review.googlesource.com/97757
      Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
      Reviewed-by: default avatarHeschi Kreinick <heschi@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      413d8a83
    • Matthew Dempsky's avatar
      cmd/compile: fix unexpected type alias crash · b3f00c69
      Matthew Dempsky authored
      OCOMPLIT stores the pre-typechecked type in n.Right, and then moves it
      to n.Type. However, it wasn't clearing n.Right, so n.Right continued
      to point to the OTYPE node. (Exception: slice literals reused n.Right
      to store the array length.)
      
      When exporting inline function bodies, we don't expect to need to save
      any type aliases. Doing so wouldn't be wrong per se, but it's
      completely unnecessary and would just bloat the export data.
      
      However, reexportdep (whose role is to identify types needed by inline
      function bodies) uses a generic tree traversal mechanism, which visits
      n.Right even for O{ARRAY,MAP,STRUCT}LIT nodes. This means it finds the
      OTYPE node, and mistakenly interpreted that the type alias needs to be
      exported.
      
      The straight forward fix is to just clear n.Right when typechecking
      composite literals.
      
      Fixes #24173.
      
      Change-Id: Ia2d556bfdd806c83695b08e18b6cd71eff0772fc
      Reviewed-on: https://go-review.googlesource.com/97719
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      b3f00c69
    • Daniel Martí's avatar
      cmd/compile: improved error message when calling a shadowed builtin · 1e308fbc
      Daniel Martí authored
      Otherwise, the error can be confusing if one forgets or doesn't know
      that the builtin is being shadowed, which is not common practice.
      
      Fixes #22822.
      
      Change-Id: I735393b5ce28cb83815a1c3f7cd2e7bb5080a32d
      Reviewed-on: https://go-review.googlesource.com/97455Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      1e308fbc
    • Adam Langley's avatar
      crypto/x509: parse invalid DNS names and email addresses. · 4b1d704d
      Adam Langley authored
      Go 1.10 requires that SANs in certificates are valid. However, a
      non-trivial number of (generally non-WebPKI) certificates have invalid
      strings in dnsName fields and some have even put those dnsName SANs in
      CA certificates.
      
      This change defers validity checking until name constraints are checked.
      
      Fixes #23995, #23711.
      
      Change-Id: I2e0ebb0898c047874a3547226b71e3029333b7f1
      Reviewed-on: https://go-review.googlesource.com/96378
      Run-TryBot: Adam Langley <agl@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4b1d704d
    • Robert Griesemer's avatar
      go/types: fix empty interface optimization (minor performance bug) · c1359db9
      Robert Griesemer authored
      The tests checking for empty interfaces so that they can be fast-
      tracked in the code actually didn't test the right field and the
      fast track code never executed. Doing it now.
      
      Change-Id: I58b2951efb3fb40b3366874c79fd653591ae0e99
      Reviewed-on: https://go-review.googlesource.com/97519Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      c1359db9
    • Robert Griesemer's avatar
      go/types: fix incorrect context when type-checking interfaces · e2b5e603
      Robert Griesemer authored
      Regression, introduced by https://go-review.googlesource.com/c/go/+/79575
      which meant to be more conservative but ended up destroying an important
      context.
      
      Fixes #24140.
      
      Change-Id: Id428dbb295ce9f11ab7cd54ec5ab51ef4291ac3f
      Reviewed-on: https://go-review.googlesource.com/97535Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      e2b5e603
    • Josh Bleecher Snyder's avatar
      cmd/compile: prevent memmove in copy when dst == src · 91a05b92
      Josh Bleecher Snyder authored
      This causes a nominal increase in binary size.
      
      name        old object-bytes  new object-bytes  delta
      Template          399kB ± 0%        399kB ± 0%    ~     (all equal)
      Unicode           207kB ± 0%        207kB ± 0%    ~     (all equal)
      GoTypes          1.23MB ± 0%       1.23MB ± 0%    ~     (all equal)
      Compiler         4.35MB ± 0%       4.35MB ± 0%  +0.01%  (p=0.008 n=5+5)
      SSA              9.77MB ± 0%       9.77MB ± 0%  +0.00%  (p=0.008 n=5+5)
      Flate             236kB ± 0%        236kB ± 0%  +0.04%  (p=0.008 n=5+5)
      GoParser          298kB ± 0%        298kB ± 0%    ~     (all equal)
      Reflect          1.03MB ± 0%       1.03MB ± 0%  +0.01%  (p=0.008 n=5+5)
      Tar               333kB ± 0%        334kB ± 0%  +0.22%  (p=0.008 n=5+5)
      XML               414kB ± 0%        414kB ± 0%  +0.02%  (p=0.008 n=5+5)
      [Geo mean]        730kB             731kB       +0.03%
      
      Change-Id: I381809fd9cfbfd6db44bd342b06285e62a3a21f1
      Reviewed-on: https://go-review.googlesource.com/94596
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      91a05b92
    • Richard Miller's avatar
      syscall: reduce redundant getwd tracking in Plan 9 · a379b7d9
      Richard Miller authored
      In Plan 9, each M is implemented as a separate OS process with
      its own working directory.  To keep the wd consistent across
      goroutines (or rescheduling of the same goroutine), CL 6350
      introduced a Fixwd procedure which checks using getwd and calls
      chdir if necessary before any syscall operating on a pathname.
      
      This wd checking will not be necessary if the pathname is absolute
      (starts with '/' or '#').  Getwd is a fairly expensive operation
      in Plan 9 (implemented by opening "." and calling Fd2path on the
      file descriptor).  Eliminating the redundant getwd calls can
      significantly reduce overhead for common operations like
      "dist test --list" which perform many syscalls on absolute pathnames.
      
      Updates #9428.
      
      Change-Id: I13fd9380779de27b0ac2f2b488229778d6839255
      Reviewed-on: https://go-review.googlesource.com/97675Reviewed-by: default avatarDavid du Colombier <0intro@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: David du Colombier <0intro@gmail.com>
      a379b7d9
    • Richard Miller's avatar
      runtime: don't try to shrink address space with brk in Plan 9 · c2cdfbd1
      Richard Miller authored
      Plan 9 won't let brk shrink the data segment if it's shared with
      other processes (which it is in the go runtime).  So we keep track
      of the notional end of the segment as it moves up and down, and
      call brk only when it grows.
      
      Corrects CL 94776.
      
      Updates #23860.
      Fixes #24013.
      
      Change-Id: I754232decab81dfd71d690f77ee6097a17d9be11
      Reviewed-on: https://go-review.googlesource.com/97595Reviewed-by: default avatarDavid du Colombier <0intro@gmail.com>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      Run-TryBot: David du Colombier <0intro@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c2cdfbd1
    • Rob Pike's avatar
      doc/faq: add a Q&A about virus scanners · 1be58dcd
      Rob Pike authored
      Fixes #23759.
      
      Change-Id: I0407ebfea507991fc205f7b04bc5798808a5c5f6
      Reviewed-on: https://go-review.googlesource.com/97496Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarDavid Symonds <dsymonds@golang.org>
      1be58dcd
    • Robert Griesemer's avatar
      cmd/compile, cmd/compile/internal/syntax: print relative column info · 0c884d08
      Robert Griesemer authored
      This change enables printing of relative column information if a
      prior line directive specified a valid column. If there was no
      line directive, or the line directive didn't specify a column
      (or the -C flag is specified), no column information is shown in
      file positions.
      
      Implementation: Column values (and line values, for that matter)
      that are zero are interpreted as "unknown". A line directive that
      doesn't specify a column records that as a zero column in the
      respective PosBase data structure. When computing relative columns,
      a relative value is zero of the base's column value is zero.
      When formatting a position, a zero column value is not printed.
      
      To make this work without special cases, the PosBase for a file
      is given a concrete (non-0:0) position 1:1 with the PosBase's
      line and column also being 1:1. In other words, at the position
      1:1 of a file, it's relative positions are starting with 1:1 as
      one would expect.
      
      In the package syntax, this requires self-recursive PosBases for
      file bases, matching what cmd/internal/src.PosBase was already
      doing. In src.PosBase, file and inlining bases also need to be
      based at 1:1 to indicate "known" positions.
      
      This change completes the cmd/compiler part of the issue below.
      
      Fixes #22662.
      
      Change-Id: I6c3d2dee26709581fba0d0261b1d12e93f1cba1a
      Reviewed-on: https://go-review.googlesource.com/97375Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      0c884d08
    • Hana Kim's avatar
      cmd/trace: fix overlappingDuration · b5bd5bfb
      Hana Kim authored
      Update #24081
      
      Change-Id: Ieccfb03c51e86f35d4629a42959c80570bd93c33
      Reviewed-on: https://go-review.googlesource.com/97555Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b5bd5bfb
    • Heschi Kreinick's avatar
      cmd/link: revert CL 89535: "fix up location lists for dsymutil" · f8973fca
      Heschi Kreinick authored
      This reverts commit 230b0bad.
      
      Reason for revert: breaking the build.
      
      Fixes #24165
      
      Change-Id: I9d8dda59f97a47e5c436f1c061b34ced82bde8ec
      Reviewed-on: https://go-review.googlesource.com/97575
      Run-TryBot: Heschi Kreinick <heschi@google.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Reviewed-by: default avatarJoe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f8973fca
    • Kunpei Sakai's avatar
      cmd/compile: remove duplicates by using finishcompare · 21343e07
      Kunpei Sakai authored
      Updates #23834
      
      Change-Id: If05001f9fd6b97d72069f440102eec6e371908dd
      Reviewed-on: https://go-review.googlesource.com/97016
      Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      21343e07
  3. 27 Feb, 2018 22 commits
    • Michael Fraenkel's avatar
      cmd/compile: convert untyped bool during walkCases · a375a6b3
      Michael Fraenkel authored
      Updates #23834.
      
      Change-Id: I1789525a992d37aae9e9b69c1e9d91437d3d0d3b
      Reviewed-on: https://go-review.googlesource.com/97001
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      a375a6b3
    • Keith Randall's avatar
      cmd/compile: mark the first word of an interface as a uintptr · 2413b548
      Keith Randall authored
      The first word of an interface is a pointer, but for the purposes
      of GC we don't need to treat it as such.
       1. If it is a non-empty interface, the pointer points to an itab
          which is always in persistentalloc space.
       2. If it is an empty interface, the pointer points to a _type.
         a. If it is a compile-time-allocated type, it points into
            the read-only data section.
         b. If it is a reflect-allocated type, it points into the Go heap.
            Reflect is responsible for keeping a reference to
            the underlying type so it won't be GCd.
      
      If we ever have a moving GC, we need to change this for 2b (as
      well as scan itabs to update their itab._type fields).
      
      Write barriers on the first word of interfaces have already been removed.
      
      Change-Id: I643e91d7ac4de980ac2717436eff94097c65d959
      Reviewed-on: https://go-review.googlesource.com/97518
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      2413b548
    • isharipo's avatar
      cmd/internal/obj/x86: add missing legacy insts · b80b4a23
      isharipo authored
      Minimizes the amount of "TODO" stuff in test suite
      of cmd/asm/internal/asm/testdata/amd64enc.s.
      
      Some instructions were already implemented, but
      test cases for them were commented-out.
      
      Does not enable MMX instructions, calls/jumps and some
      segment registers instructions.
      
      -- Affected instructions --
      BLENDVPD, BLENDVPS
      BSWAPW
      CBW
      CDQE
      CLAC
      CLFLUSHOPT
      CMPXCHG16B
      CRC32B, CRC32L, CRC32W
      CWDE
      FBLD
      FBSTP
      FCMOVB
      FCMOVBE
      FCMOVE
      FCMOVNB
      FCMOVNBE
      FCMOVU
      FCOMI
      FCOMIP
      IMUL3L, IMUL3Q, IMUL3W
      ICEBP, INT
      INVPCID
      LARQ
      LGDT, LIDT, LLDT
      LMSW
      LTR
      LZCNTL, LZCNTQ, LZCNTW
      MONITOR
      MOVBELL, MOVBEQQ, MOVBEWW
      MOVBQZX
      MOVQ
      MOVSWW, MOVZWW
      MWAIT
      NOPL, NOPW
      PBLENDVB
      PEXTRW
      RDPKRU
      RDRANDL, RDRANDQ, RDRANDW
      RDSEEDL, RDSEEDQ, RDSEEDW
      RDTSCP
      SAHF
      SGDT, SIDT
      SLDTL, SLDTQ, SLDTW
      SMSWL, SMSWQ, SMSWW
      STAC
      STRL, STRQ, STRW
      SYSENTER, SYSENTER64
      SYSEXIT, SYSEXIT64
      SHA256RNDS2
      TZCNTL, TZCNTQ, TZCNTW
      UD1, UD2
      WRPKRU
      XRSTOR, XRSTOR64
      XRSTORS, XRSTORS64
      XSAVE, XSAVE64
      XSAVEC, XSAVEC64
      XSAVEOPT, XSAVEOPT64
      XSAVES, XSAVES64
      XSETBV
      
      Fixes #6739
      
      Change-Id: I8b125d9a5ea39bb4b9da7e66a63a16f609cef376
      Reviewed-on: https://go-review.googlesource.com/97235
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b80b4a23
    • Daniel Martí's avatar
      cmd/vet: type conversions never have side effects · c55505ba
      Daniel Martí authored
      Make the hasSideEffects func use type information to see if a CallExpr
      is a type conversion or not. In case it is, there cannot be any side
      effects.
      
      Now that vet always has type information, we can afford to use it here.
      Update the tests and remove the TODO there too.
      
      Change-Id: I74fdacf830aedf2371e67ba833802c414178caf1
      Reviewed-on: https://go-review.googlesource.com/79536Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      c55505ba
    • Ilya Tocar's avatar
      cmd/compile/internal/ssa: refactor zeroUpper32Bits · c2ccc481
      Ilya Tocar authored
      Explicitly whitelist args of OpSelect{1|2} that zero upper 32 bits.
      Use better values in corresponding test.
      This should have been a part of  CL 96815, but it was submitted, before
      relevant comments.
      
      Change-Id: Ic85d90a4471a17f6d64f8f5c405f21378bf3a30d
      Reviewed-on: https://go-review.googlesource.com/97295
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      c2ccc481
    • Darshan Parajuli's avatar
      fmt: change some unexported method names to camel case · ccaa2bc5
      Darshan Parajuli authored
      Change-Id: I12f96a9397cfaebe11e616543d804bd62cd72da0
      Reviewed-on: https://go-review.googlesource.com/97379Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      ccaa2bc5
    • Josh Bleecher Snyder's avatar
      cmd/compile: clean up comments · 15b0d137
      Josh Bleecher Snyder authored
      Follow-up to CL 94256.
      
      Change-Id: I61c450dee5975492192453738f734f772e95c1a5
      Reviewed-on: https://go-review.googlesource.com/97515Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      15b0d137
    • ChrisALiles's avatar
      cmd/compile: move the SSA local type definitions to a single location · 4f5389c3
      ChrisALiles authored
      Fixes #20304
      
      Change-Id: I52ee02d1602ed7fffc96b27fd60990203c771aaf
      Reviewed-on: https://go-review.googlesource.com/94256
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      4f5389c3
    • Ilya Tocar's avatar
      cmd/compile/internal/ssa: combine byte stores on amd64 · 0f2ef0ad
      Ilya Tocar authored
      On amd64 we optimize  encoding/binary.BigEndian.PutUint{16,32,64}
      into bswap + single store, but strangely enough not LittleEndian.PutUint{16,32}.
      We have similar rules, but they use 64-bit shifts everywhere,
      and fail for 16/32-bit case. Add rules that matchLittleEndian.PutUint,
      and relevant tests. Performance results:
      
      LittleEndianPutUint16-6    1.43ns ± 0%    1.07ns ± 0%   -25.17%  (p=0.000 n=9+9)
      LittleEndianPutUint32-6    2.14ns ± 0%    0.94ns ± 0%   -56.07%  (p=0.019 n=6+8)
      
      LittleEndianPutUint16-6  1.40GB/s ± 0%  1.87GB/s ± 0%   +33.24%  (p=0.000 n=9+9)
      LittleEndianPutUint32-6  1.87GB/s ± 0%  4.26GB/s ± 0%  +128.54%  (p=0.000 n=8+8)
      
      Discovered, while looking at ethereum_ethash from community benchmarks
      
      Change-Id: Id86d5443687ecddd2803edf3203dbdd1246f61fe
      Reviewed-on: https://go-review.googlesource.com/95475
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      0f2ef0ad
    • Matthew Dempsky's avatar
      cmd/compile: fix inlining of constant if statements · d7cd61ce
      Matthew Dempsky authored
      We accidentally overlooked needing to still visit Ninit for OIF
      statements with constant conditions in golang.org/cl/96778.
      
      Fixes #24120.
      
      Change-Id: I5b341913065ff90e1163fb872b9e8d47e2a789d2
      Reviewed-on: https://go-review.googlesource.com/97475
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d7cd61ce
    • Heschi Kreinick's avatar
      cmd/link: fix up location lists for dsymutil · 230b0bad
      Heschi Kreinick authored
      LLVM tools, particularly lldb and dsymutil, don't support base address
      selection entries in location lists. When targeting GOOS=darwin,
      mode, have the linker translate location lists to CU-relative form
      instead.
      
      Technically, this isn't necessary when linking internally, as long as
      nobody plans to use anything other than Delve to look at the DWARF. But
      someone might want to use lldb, and it's really confusing when dwarfdump
      shows gibberish for the location entries. The performance cost isn't
      noticeable, so enable it even for internal linking.
      
      Doing this in the linker is a little weird, but it was more expensive in
      the compiler, probably because the compiler is much more stressful to
      the GC. Also, if we decide to only do it for external linking, the
      compiler can't see the link mode.
      
      Benchmark before and after this commit on Mac with -dwarflocationlists=1:
      
      name        old time/op       new time/op       delta
      StdCmd            21.3s ± 1%        21.3s ± 1%    ~     (p=0.310 n=27+27)
      
      Only StdCmd is relevant, because only StdCmd runs the linker. Whatever
      the cost is here, it's not very large.
      
      Change-Id: I200246dedaee4f824966f7551ac95f8d7123d3b1
      Reviewed-on: https://go-review.googlesource.com/89535Reviewed-by: default avatarDavid Chase <drchase@google.com>
      230b0bad
    • Tobias Klauser's avatar
      runtime: simplify walltime/nanotime on linux/{386,amd64} · 5b21bf6f
      Tobias Klauser authored
      Avoid an unnecessary MOVL/MOVQ.
      
      Follow CL 97377
      
      Change-Id: Ic43976d6b0cece3ed455496d18aedd67e0337d3f
      Reviewed-on: https://go-review.googlesource.com/97358
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      5b21bf6f
    • Tobias Klauser's avatar
      os, syscall: use pipe2 instead of pipe syscall on OpenBSD · 2013ad89
      Tobias Klauser authored
      The pipe2 syscall is part of OpenBSD since version 5.7 and thus exists in
      all officially supported versions.
      
      Follows CL 38426 and CL 94035
      
      Change-Id: I8f93ecbc89664241f1b6b0d069e948776941b1d0
      Reviewed-on: https://go-review.googlesource.com/97356
      Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      2013ad89
    • Philip Hofer's avatar
      cmd/compile/internal/ssa: clear branch likeliness in clobberBlock · 81786649
      Philip Hofer authored
      The branchelim pass makes some blocks unreachable, but does not
      remove them from Func.Values. Consequently, ssacheck complains
      when it finds a block with a non-zero likeliness value but no
      successors.
      
      Fixes #24014
      
      Change-Id: I2dcf1d8f4e769a2f363508dab3b11198ead336b6
      Reviewed-on: https://go-review.googlesource.com/96075Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      Run-TryBot: Philip Hofer <phofer@umich.edu>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      81786649
    • Josh Bleecher Snyder's avatar
      runtime: improve 386/amd64 systemstack · c5d6c42d
      Josh Bleecher Snyder authored
      Minor improvements, noticed while investigating other things.
      
      Shorten the prologue.
      
      Make branch direction better for static branch prediction;
      the most common case by far is switching stacks (g==curg).
      
      Change-Id: Ib2211d3efecb60446355cda56194221ccb78057d
      Reviewed-on: https://go-review.googlesource.com/97377
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      c5d6c42d
    • Joe Tsai's avatar
      go/doc: replace unexported values with underscore if necessary · f399af31
      Joe Tsai authored
      When a var or const declaration contains a mixture of exported and unexported
      identifiers, replace the unexported identifiers with underscore.
      Otherwise, the LHS and the RHS may mismatch or the declaration may mismatch
      with an iota from above.
      
      Fixes #22426
      
      Change-Id: Icd5fb81b4ece647232a9f7d05cb140227091e9cb
      Reviewed-on: https://go-review.googlesource.com/94877
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      f399af31
    • erifan01's avatar
      math: optimize sinh and cosh · ed6c6c9c
      erifan01 authored
      Improve performance by reducing unnecessary function calls
      
      Benchmarks:
      
      Tme    old time/op  new time/op  delta
      Cosh-8   229ns ± 0%   138ns ± 0%  -39.74%  (p=0.008 n=5+5)
      Sinh-8   231ns ± 0%   139ns ± 0%  -39.83%  (p=0.008 n=5+5)
      
      Change-Id: Icab5485849bbfaafca8429d06b67c558101f4f3c
      Reviewed-on: https://go-review.googlesource.com/85477Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      ed6c6c9c
    • Josh Bleecher Snyder's avatar
      runtime: short-circuit typedmemmove when dst==src · 486caa26
      Josh Bleecher Snyder authored
      Change-Id: I855268a4c0d07ad602ec90f5da66422d3d87c5f2
      Reviewed-on: https://go-review.googlesource.com/94595
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      486caa26
    • Giovanni Bajo's avatar
      cmd/compile: fix bit-test rules for highest bit · 68def820
      Giovanni Bajo authored
      Bit-test rules failed to match when matching the highest bit
      of a word because operands in SSA are signed int64. Fix
      them by treating them as unsigned (and correctly handling
      32-bit operands as well).
      
      Tests will be added in next CL.
      
      Change-Id: I491c4e88e7e2f87e9bb72bd0d9fa5d4025b90736
      Reviewed-on: https://go-review.googlesource.com/94765Reviewed-by: default avatarKeith Randall <khr@golang.org>
      68def820
    • Giovanni Bajo's avatar
      cmd/compile: fold bit masking on bits that have been shifted away · 098208a0
      Giovanni Bajo authored
      Spotted while working on #18943, it triggers once during bootstrap.
      
      Change-Id: Ia4330ccc6395627c233a8eb4dcc0e3e2a770bea7
      Reviewed-on: https://go-review.googlesource.com/94764Reviewed-by: default avatarKeith Randall <khr@golang.org>
      098208a0
    • Chad Rosier's avatar
      cmd/compile/internal/ssa: combine zero stores into larger stores on arm64 · ecd9e8a2
      Chad Rosier authored
      This reduces the go tool binary on arm64 by 12k.
      
      go1 results on Amberwing:
      name                   old time/op    new time/op    delta
      RegexpMatchEasy0_32       249ns ± 0%     249ns ± 0%    ~     (p=0.087 n=10+10)
      RegexpMatchEasy0_1K       584ns ± 0%     584ns ± 0%    ~     (all equal)
      RegexpMatchEasy1_32       246ns ± 0%     246ns ± 0%    ~     (p=1.000 n=10+10)
      RegexpMatchEasy1_1K       806ns ± 0%     806ns ± 0%    ~     (p=0.706 n=10+9)
      RegexpMatchMedium_32      314ns ± 0%     314ns ± 0%    ~     (all equal)
      RegexpMatchMedium_1K     52.1µs ± 0%    52.1µs ± 0%    ~     (p=0.245 n=10+8)
      RegexpMatchHard_32       2.75µs ± 1%    2.75µs ± 1%    ~     (p=0.690 n=10+10)
      RegexpMatchHard_1K       78.9µs ± 0%    78.9µs ± 1%    ~     (p=0.295 n=9+9)
      FmtFprintfEmpty          58.5ns ± 0%    58.5ns ± 0%    ~     (all equal)
      FmtFprintfString          112ns ± 0%     112ns ± 0%    ~     (all equal)
      FmtFprintfInt             117ns ± 0%     116ns ± 0%  -0.85%  (p=0.000 n=10+10)
      FmtFprintfIntInt          181ns ± 0%     181ns ± 0%    ~     (all equal)
      FmtFprintfPrefixedInt     222ns ± 0%     224ns ± 0%  +0.90%  (p=0.000 n=9+10)
      FmtFprintfFloat           318ns ± 1%     322ns ± 0%    ~     (p=0.059 n=10+8)
      FmtManyArgs               736ns ± 1%     735ns ± 0%    ~     (p=0.206 n=9+9)
      Gzip                      437ms ± 0%     436ms ± 0%  -0.25%  (p=0.000 n=10+10)
      HTTPClientServer         89.8µs ± 1%    90.2µs ± 2%    ~     (p=0.393 n=10+10)
      JSONEncode               20.1ms ± 1%    20.2ms ± 1%    ~     (p=0.065 n=9+10)
      JSONDecode               94.2ms ± 1%    93.9ms ± 1%  -0.42%  (p=0.043 n=10+10)
      GobDecode                12.7ms ± 1%    12.8ms ± 2%  +0.94%  (p=0.019 n=10+10)
      GobEncode                12.1ms ± 0%    12.1ms ± 0%    ~     (p=0.052 n=10+10)
      Mandelbrot200            5.06ms ± 0%    5.05ms ± 0%  -0.04%  (p=0.000 n=9+10)
      TimeParse                 450ns ± 3%     446ns ± 0%    ~     (p=0.238 n=10+9)
      TimeFormat                485ns ± 1%     483ns ± 1%    ~     (p=0.073 n=10+10)
      Template                 90.4ms ± 0%    90.7ms ± 0%  +0.29%  (p=0.000 n=8+10)
      GoParse                  6.01ms ± 0%    6.03ms ± 0%  +0.35%  (p=0.000 n=10+10)
      BinaryTree17              11.7s ± 0%     11.7s ± 0%    ~     (p=0.481 n=10+10)
      Revcomp                   669ms ± 0%     669ms ± 0%    ~     (p=0.315 n=10+10)
      Fannkuch11                3.40s ± 0%     3.37s ± 0%  -0.92%  (p=0.000 n=10+10)
      [Geo mean]               67.9µs         67.9µs       +0.02%
      
      name                   old speed      new speed      delta
      RegexpMatchEasy0_32     128MB/s ± 0%   128MB/s ± 0%  -0.08%  (p=0.003 n=8+10)
      RegexpMatchEasy0_1K    1.75GB/s ± 0%  1.75GB/s ± 0%    ~     (p=0.642 n=8+10)
      RegexpMatchEasy1_32     130MB/s ± 0%   130MB/s ± 0%    ~     (p=0.690 n=10+9)
      RegexpMatchEasy1_1K    1.27GB/s ± 0%  1.27GB/s ± 0%    ~     (p=0.661 n=10+9)
      RegexpMatchMedium_32   3.18MB/s ± 0%  3.18MB/s ± 0%    ~     (all equal)
      RegexpMatchMedium_1K   19.7MB/s ± 0%  19.6MB/s ± 0%    ~     (p=0.190 n=10+9)
      RegexpMatchHard_32     11.6MB/s ± 0%  11.6MB/s ± 1%    ~     (p=0.669 n=10+10)
      RegexpMatchHard_1K     13.0MB/s ± 0%  13.0MB/s ± 0%    ~     (p=0.718 n=9+9)
      Gzip                   44.4MB/s ± 0%  44.5MB/s ± 0%  +0.24%  (p=0.000 n=10+10)
      JSONEncode             96.5MB/s ± 1%  96.1MB/s ± 1%    ~     (p=0.065 n=9+10)
      JSONDecode             20.6MB/s ± 1%  20.7MB/s ± 1%  +0.42%  (p=0.041 n=10+10)
      GobDecode              60.6MB/s ± 1%  60.0MB/s ± 2%  -0.92%  (p=0.016 n=10+10)
      GobEncode              63.4MB/s ± 0%  63.6MB/s ± 0%    ~     (p=0.055 n=10+10)
      Template               21.5MB/s ± 0%  21.4MB/s ± 0%  -0.30%  (p=0.000 n=9+10)
      GoParse                9.64MB/s ± 0%  9.61MB/s ± 0%  -0.36%  (p=0.000 n=10+10)
      Revcomp                 380MB/s ± 0%   380MB/s ± 0%    ~     (p=0.323 n=10+10)
      [Geo mean]             56.0MB/s       55.9MB/s       -0.07%
      
      Change-Id: Ia732fa57fbcf4767d72382516d9f16705d177736
      Reviewed-on: https://go-review.googlesource.com/96435
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      ecd9e8a2
    • Josh Bleecher Snyder's avatar
      cmd/compile: tighten after lowering · 3a9e4440
      Josh Bleecher Snyder authored
      Moving tighten after lowering benefits from the removal of values by
      lowering and lowered CSE. It lets us make better decisions about
      which values are rematerializable and which generate flags.
      Empirically, it lowers stack usage (by avoiding spills)
      and generates slightly smaller and faster binaries.
      
      
      Fixes #19853
      Fixes #21041
      
      name        old time/op       new time/op       delta
      Template          195ms ± 4%        193ms ± 4%  -1.33%  (p=0.000 n=92+97)
      Unicode          94.1ms ± 9%       92.5ms ± 8%  -1.66%  (p=0.002 n=97+95)
      GoTypes           572ms ± 5%        566ms ± 7%  -0.92%  (p=0.001 n=95+98)
      Compiler          2.56s ± 4%        2.52s ± 3%  -1.41%  (p=0.000 n=94+97)
      SSA               6.52s ± 2%        6.47s ± 3%  -0.82%  (p=0.000 n=96+94)
      Flate             117ms ± 5%        116ms ± 7%  -0.72%  (p=0.018 n=97+97)
      GoParser          148ms ± 6%        146ms ± 4%  -0.97%  (p=0.002 n=98+95)
      Reflect           370ms ± 7%        363ms ± 6%  -1.79%  (p=0.000 n=99+98)
      Tar               175ms ± 6%        173ms ± 6%  -1.11%  (p=0.001 n=94+95)
      XML               204ms ± 6%        201ms ± 5%  -1.49%  (p=0.000 n=97+96)
      [Geo mean]        363ms             359ms       -1.22%
      
      name        old user-time/op  new user-time/op  delta
      Template          251ms ± 5%        245ms ± 5%  -2.40%  (p=0.000 n=97+93)
      Unicode           131ms ±10%        128ms ± 9%  -1.93%  (p=0.001 n=100+99)
      GoTypes           760ms ± 4%        752ms ± 4%  -0.96%  (p=0.000 n=97+95)
      Compiler          3.51s ± 3%        3.48s ± 2%  -1.04%  (p=0.000 n=96+95)
      SSA               9.57s ± 4%        9.52s ± 2%  -0.50%  (p=0.004 n=97+96)
      Flate             149ms ± 6%        147ms ± 6%  -1.46%  (p=0.000 n=98+96)
      GoParser          184ms ± 5%        181ms ± 7%  -1.84%  (p=0.000 n=98+97)
      Reflect           469ms ± 6%        461ms ± 6%  -1.69%  (p=0.000 n=100+98)
      Tar               219ms ± 8%        217ms ± 7%  -0.90%  (p=0.035 n=96+96)
      XML               255ms ± 5%        251ms ± 6%  -1.48%  (p=0.000 n=98+98)
      [Geo mean]        476ms             469ms       -1.42%
      
      name        old alloc/op      new alloc/op      delta
      Template         37.8MB ± 0%       37.8MB ± 0%  -0.17%  (p=0.000 n=100+100)
      Unicode          28.8MB ± 0%       28.8MB ± 0%  -0.02%  (p=0.000 n=100+95)
      GoTypes           112MB ± 0%        112MB ± 0%  -0.20%  (p=0.000 n=100+97)
      Compiler          466MB ± 0%        464MB ± 0%  -0.27%  (p=0.000 n=100+100)
      SSA              1.49GB ± 0%       1.49GB ± 0%  -0.08%  (p=0.000 n=100+99)
      Flate            24.4MB ± 0%       24.3MB ± 0%  -0.25%  (p=0.000 n=98+99)
      GoParser         30.7MB ± 0%       30.6MB ± 0%  -0.26%  (p=0.000 n=99+100)
      Reflect          76.4MB ± 0%       76.4MB ± 0%    ~     (p=0.253 n=100+100)
      Tar              38.9MB ± 0%       38.8MB ± 0%  -0.20%  (p=0.000 n=100+97)
      XML              41.5MB ± 0%       41.4MB ± 0%  -0.19%  (p=0.000 n=100+98)
      [Geo mean]       77.5MB            77.4MB       -0.16%
      
      name        old allocs/op     new allocs/op     delta
      Template           381k ± 0%         381k ± 0%  -0.15%  (p=0.000 n=100+100)
      Unicode            342k ± 0%         342k ± 0%  -0.01%  (p=0.000 n=100+98)
      GoTypes           1.19M ± 0%        1.18M ± 0%  -0.24%  (p=0.000 n=100+100)
      Compiler          4.52M ± 0%        4.50M ± 0%  -0.29%  (p=0.000 n=100+100)
      SSA               12.3M ± 0%        12.3M ± 0%  -0.11%  (p=0.000 n=100+100)
      Flate              234k ± 0%         234k ± 0%  -0.26%  (p=0.000 n=99+96)
      GoParser           318k ± 0%         317k ± 0%  -0.21%  (p=0.000 n=99+100)
      Reflect            974k ± 0%         974k ± 0%  -0.03%  (p=0.000 n=100+100)
      Tar                392k ± 0%         391k ± 0%  -0.17%  (p=0.000 n=100+99)
      XML                404k ± 0%         403k ± 0%  -0.24%  (p=0.000 n=99+99)
      [Geo mean]         794k              792k       -0.17%
      
      name        old object-bytes  new object-bytes  delta
      Template          393kB ± 0%        392kB ± 0%  -0.19%  (p=0.008 n=5+5)
      Unicode           207kB ± 0%        207kB ± 0%    ~     (all equal)
      GoTypes          1.23MB ± 0%       1.22MB ± 0%  -0.11%  (p=0.008 n=5+5)
      Compiler         4.34MB ± 0%       4.33MB ± 0%  -0.15%  (p=0.008 n=5+5)
      SSA              9.85MB ± 0%       9.85MB ± 0%  -0.07%  (p=0.008 n=5+5)
      Flate             235kB ± 0%        234kB ± 0%  -0.59%  (p=0.008 n=5+5)
      GoParser          297kB ± 0%        296kB ± 0%  -0.22%  (p=0.008 n=5+5)
      Reflect          1.03MB ± 0%       1.03MB ± 0%  -0.00%  (p=0.008 n=5+5)
      Tar               332kB ± 0%        331kB ± 0%  -0.15%  (p=0.008 n=5+5)
      XML               413kB ± 0%        412kB ± 0%  -0.19%  (p=0.008 n=5+5)
      [Geo mean]        728kB             727kB       -0.17%
      
      Change-Id: I9b5cdb668ed102a001897a05e833105acba220a2
      Reviewed-on: https://go-review.googlesource.com/95995
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      3a9e4440