1. 26 Sep, 2017 3 commits
  2. 25 Sep, 2017 13 commits
    • Joe Tsai's avatar
      archive/tar: avoid empty IO operations · 7246585f
      Joe Tsai authored
      The interfaces for io.Reader and io.Writer permit calling Read/Write
      with an empty buffer. However, this condition is often not well tested
      and can lead to bugs in various implementations of io.Reader and io.Writer.
      For example, see #22028 for buggy io.Reader in the bzip2 package.
      
      We reduce the likelihood of hitting these bugs by adjusting
      regFileReader.Read and regFileWriter.Write to avoid performing
      Read and Write calls when the buffer is known to be empty.
      
      Fixes #22029
      
      Change-Id: Ie4a26be53cf87bc4d2abd951fa005db5871cc75c
      Reviewed-on: https://go-review.googlesource.com/66111
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      Reviewed-by: default avatarGiovanni Bajo <rasky@develer.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7246585f
    • Joe Tsai's avatar
      compress/bzip2: fix checksum mismatch on empty reads · 57f7bc3a
      Joe Tsai authored
      Previously, the read method checked whether the current block
      was fully consumed or not based on whether the buffer could be filled
      with a non-zero number of bytes. This check is problematic because
      zero bytes could be read if the provided buffer is empty.
      
      We fix this case by simply checking for whether the input buffer
      provided by the user was empty or not. If empty, we assume that
      we could not read any bytes because the buffer was too small,
      rather than indicating that the current block was fully exhausted.
      
      This check causes bzip2.Reader to be unable to make progress
      on the next block unless a non-empty buffer is provided.
      However, that is an entirely reasonable expectation since a
      non-empty buffer needs to be provided eventually anyways to
      read the actual contents of subsequent blocks.
      
      Fixes #22028
      
      Change-Id: I2bb1b2d54e78567baf2bf7b490a272c0853d7bfe
      Reviewed-on: https://go-review.googlesource.com/66110Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      57f7bc3a
    • Daniel Martí's avatar
      cmd/compile: add runtime GC funcs to inlining test · 4d3d3334
      Daniel Martí authored
      This is based on a list that Austin Clements provided in mid-2016. It is
      mostly untouched, except for the fact that the wbufptr funcs were
      removed from the runtime thus removed from the lits here too.
      
      Add a section for these GC funcs, since there are quite a lot of them
      and the runtime has tons of funcs that we want to inline. As before,
      sort this section too.
      
      Also place some of these funcs out of the GC section, as they are not
      directly related to the GC.
      
      Updates #21851.
      
      Change-Id: I35eb777a4c50b5f655618920dc2bc568c7c30ff5
      Reviewed-on: https://go-review.googlesource.com/65654
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      4d3d3334
    • Ilya Tocar's avatar
      regexp: make (*bitState).push inlinable · 1ae67965
      Ilya Tocar authored
      By refactoring job.arg from int with 0/1 as the only valid values into bool
      and simplifying (*bitState).push, we reduce the number of nodes below the inlining threshold.
      This improves backtracking regexp performance by 5-10% and go1 geomean  by 1.7%
      Full performance data below:
      
      name                                      old time/op    new time/op     delta
      Find-6                                       510ns ± 0%      480ns ± 1%   -5.90%  (p=0.000 n=10+10)
      FindString-6                                 504ns ± 1%      479ns ± 1%   -5.10%  (p=0.000 n=10+10)
      FindSubmatch-6                               689ns ± 1%      659ns ± 1%   -4.27%  (p=0.000 n=9+10)
      FindStringSubmatch-6                         659ns ± 0%      628ns ± 1%   -4.69%  (p=0.000 n=8+10)
      Literal-6                                    174ns ± 1%      171ns ± 1%   -1.50%  (p=0.000 n=10+10)
      NotLiteral-6                                2.89µs ± 1%     2.72µs ± 0%   -5.84%  (p=0.000 n=10+9)
      MatchClass-6                                4.65µs ± 1%     4.28µs ± 1%   -7.96%  (p=0.000 n=10+10)
      MatchClass_InRange-6                        4.15µs ± 1%     3.80µs ± 0%   -8.61%  (p=0.000 n=10+8)
      ReplaceAll-6                                2.72µs ± 1%     2.60µs ± 1%   -4.68%  (p=0.000 n=10+10)
      AnchoredLiteralShortNonMatch-6               158ns ± 1%      153ns ± 1%   -3.03%  (p=0.000 n=10+10)
      AnchoredLiteralLongNonMatch-6                176ns ± 1%      176ns ± 0%     ~     (p=1.000 n=10+9)
      AnchoredShortMatch-6                         260ns ± 0%      255ns ± 1%   -1.84%  (p=0.000 n=9+10)
      AnchoredLongMatch-6                          456ns ± 0%      455ns ± 0%   -0.19%  (p=0.008 n=8+10)
      OnePassShortA-6                             1.13µs ± 1%     1.12µs ± 0%   -0.57%  (p=0.046 n=10+8)
      NotOnePassShortA-6                          1.14µs ± 1%     1.14µs ± 1%     ~     (p=0.162 n=10+10)
      OnePassShortB-6                              908ns ± 0%      893ns ± 0%   -1.60%  (p=0.000 n=8+9)
      NotOnePassShortB-6                           857ns ± 0%      803ns ± 1%   -6.34%  (p=0.000 n=8+10)
      OnePassLongPrefix-6                          190ns ± 0%      190ns ± 1%     ~     (p=0.059 n=8+10)
      OnePassLongNotPrefix-6                       722ns ± 1%      722ns ± 1%     ~     (p=0.451 n=10+10)
      MatchParallelShared-6                        810ns ± 2%      807ns ± 2%     ~     (p=0.643 n=10+10)
      MatchParallelCopied-6                       72.1ns ± 1%     69.4ns ± 1%   -3.81%  (p=0.000 n=10+10)
      QuoteMetaAll-6                               213ns ± 2%      216ns ± 3%     ~     (p=0.284 n=10+10)
      QuoteMetaNone-6                             89.7ns ± 1%     89.8ns ± 1%     ~     (p=0.616 n=10+10)
      Match/Easy0/32-6                             127ns ± 1%      127ns ± 1%     ~     (p=0.977 n=10+10)
      Match/Easy0/1K-6                             566ns ± 0%      566ns ± 0%     ~     (p=1.000 n=8+8)
      Match/Easy0/32K-6                           9.30µs ± 1%     9.28µs ± 1%     ~     (p=0.529 n=10+10)
      Match/Easy0/1M-6                             460µs ± 1%      460µs ± 1%     ~     (p=0.853 n=10+10)
      Match/Easy0/32M-6                           15.0ms ± 0%     15.1ms ± 0%   +0.77%  (p=0.000 n=9+8)
      Match/Easy0i/32-6                           2.10µs ± 1%     1.98µs ± 0%   -6.02%  (p=0.000 n=10+8)
      Match/Easy0i/1K-6                           61.5µs ± 0%     57.2µs ± 0%   -6.97%  (p=0.000 n=10+9)
      Match/Easy0i/32K-6                          2.75ms ± 0%     2.72ms ± 0%   -1.10%  (p=0.000 n=9+9)
      Match/Easy0i/1M-6                           88.0ms ± 0%     86.9ms ± 1%   -1.29%  (p=0.000 n=8+10)
      Match/Easy0i/32M-6                           2.82s ± 0%      2.77s ± 1%   -1.81%  (p=0.000 n=8+10)
      Match/Easy1/32-6                             123ns ± 1%      124ns ± 1%   +0.90%  (p=0.001 n=10+10)
      Match/Easy1/1K-6                            1.70µs ± 1%     1.65µs ± 0%   -3.18%  (p=0.000 n=9+10)
      Match/Easy1/32K-6                           69.1µs ± 0%     68.4µs ± 1%   -0.95%  (p=0.000 n=8+10)
      Match/Easy1/1M-6                            2.46ms ± 1%     2.42ms ± 1%   -1.66%  (p=0.000 n=10+10)
      Match/Easy1/32M-6                           78.4ms ± 1%     77.5ms ± 0%   -1.08%  (p=0.000 n=10+9)
      Match/Medium/32-6                           2.07µs ± 1%     1.91µs ± 1%   -7.69%  (p=0.000 n=10+10)
      Match/Medium/1K-6                           62.8µs ± 0%     58.0µs ± 1%   -7.70%  (p=0.000 n=8+10)
      Match/Medium/32K-6                          2.63ms ± 1%     2.58ms ± 1%   -2.14%  (p=0.000 n=10+10)
      Match/Medium/1M-6                           84.6ms ± 0%     82.5ms ± 0%   -2.37%  (p=0.000 n=8+9)
      Match/Medium/32M-6                           2.71s ± 0%      2.64s ± 0%   -2.46%  (p=0.000 n=10+9)
      Match/Hard/32-6                             3.26µs ± 1%     2.98µs ± 1%   -8.49%  (p=0.000 n=10+10)
      Match/Hard/1K-6                              100µs ± 0%       90µs ± 1%   -9.55%  (p=0.000 n=9+10)
      Match/Hard/32K-6                            3.82ms ± 0%     3.82ms ± 1%     ~     (p=0.515 n=8+10)
      Match/Hard/1M-6                              122ms ± 1%      123ms ± 0%   +0.66%  (p=0.000 n=10+8)
      Match/Hard/32M-6                             3.89s ± 1%      3.91s ± 1%     ~     (p=0.105 n=10+10)
      Match/Hard1/32-6                            18.1µs ± 1%     16.1µs ± 1%  -11.31%  (p=0.000 n=10+10)
      Match/Hard1/1K-6                             565µs ± 0%      493µs ± 1%  -12.65%  (p=0.000 n=8+10)
      Match/Hard1/32K-6                           18.8ms ± 0%     18.8ms ± 1%     ~     (p=0.905 n=9+10)
      Match/Hard1/1M-6                             602ms ± 1%      602ms ± 1%     ~     (p=0.278 n=9+10)
      Match/Hard1/32M-6                            19.1s ± 1%      19.2s ± 1%   +0.31%  (p=0.035 n=9+10)
      Match_onepass_regex/32-6                    6.32µs ± 1%     6.34µs ± 1%     ~     (p=0.060 n=10+10)
      Match_onepass_regex/1K-6                     204µs ± 1%      204µs ± 1%     ~     (p=0.842 n=9+10)
      Match_onepass_regex/32K-6                   6.53ms ± 0%     6.55ms ± 1%   +0.36%  (p=0.005 n=10+10)
      Match_onepass_regex/1M-6                     209ms ± 0%      208ms ± 1%   -0.65%  (p=0.034 n=8+10)
      Match_onepass_regex/32M-6                    6.72s ± 0%      6.68s ± 1%   -0.74%  (p=0.000 n=9+10)
      CompileOnepass/^(?:(?:(?:.(?:$))?))...-6    7.02µs ± 1%     7.02µs ± 1%     ~     (p=0.671 n=10+10)
      CompileOnepass/^abcd$-6                     5.65µs ± 1%     5.65µs ± 1%     ~     (p=0.411 n=10+9)
      CompileOnepass/^(?:(?:a{0,})*?)$-6          7.06µs ± 1%     7.06µs ± 1%     ~     (p=0.912 n=10+10)
      CompileOnepass/^(?:(?:a+)*)$-6              6.40µs ± 1%     6.41µs ± 1%     ~     (p=0.699 n=10+10)
      CompileOnepass/^(?:(?:a|(?:aa)))$-6         8.18µs ± 2%     8.16µs ± 1%     ~     (p=0.529 n=10+10)
      CompileOnepass/^(?:[^\s\S])$-6              5.08µs ± 1%     5.17µs ± 1%   +1.77%  (p=0.000 n=9+10)
      CompileOnepass/^(?:(?:(?:a*)+))$-6          6.86µs ± 1%     6.85µs ± 0%     ~     (p=0.190 n=10+9)
      CompileOnepass/^[a-c]+$-6                   5.14µs ± 1%     5.11µs ± 0%   -0.53%  (p=0.041 n=10+10)
      CompileOnepass/^[a-c]*$-6                   5.62µs ± 1%     5.63µs ± 1%     ~     (p=0.382 n=10+10)
      CompileOnepass/^(?:a*)$-6                   5.76µs ± 1%     5.73µs ± 1%   -0.41%  (p=0.008 n=9+10)
      CompileOnepass/^(?:(?:aa)|a)$-6             7.89µs ± 1%     7.84µs ± 1%   -0.66%  (p=0.020 n=10+10)
      CompileOnepass/^...$-6                      5.38µs ± 1%     5.38µs ± 1%     ~     (p=0.857 n=9+10)
      CompileOnepass/^(?:a|(?:aa))$-6             7.80µs ± 2%     7.82µs ± 1%     ~     (p=0.342 n=10+10)
      CompileOnepass/^a((b))c$-6                  7.75µs ± 1%     7.78µs ± 1%     ~     (p=0.172 n=10+10)
      CompileOnepass/^a.[l-nA-Cg-j]?e$-6          8.39µs ± 1%     8.42µs ± 1%     ~     (p=0.138 n=10+10)
      CompileOnepass/^a((b))$-6                   6.92µs ± 1%     6.95µs ± 1%     ~     (p=0.159 n=10+10)
      CompileOnepass/^a(?:(b)|(c))c$-6            10.0µs ± 1%     10.0µs ± 1%     ~     (p=0.896 n=10+10)
      CompileOnepass/^a(?:b|c)$-6                 5.62µs ± 1%     5.66µs ± 1%   +0.71%  (p=0.023 n=10+10)
      CompileOnepass/^a(?:b?|c)$-6                8.49µs ± 1%     8.43µs ± 1%   -0.69%  (p=0.010 n=10+10)
      CompileOnepass/^a(?:b?|c+)$-6               9.26µs ± 1%     9.28µs ± 1%     ~     (p=0.448 n=10+10)
      CompileOnepass/^a(?:bc)+$-6                 6.52µs ± 1%     6.46µs ± 2%   -1.02%  (p=0.003 n=10+10)
      CompileOnepass/^a(?:[bcd])+$-6              6.29µs ± 1%     6.32µs ± 1%     ~     (p=0.256 n=10+10)
      CompileOnepass/^a((?:[bcd])+)$-6            7.77µs ± 1%     7.79µs ± 1%     ~     (p=0.105 n=10+10)
      CompileOnepass/^a(:?b|c)*d$-6               14.0µs ± 1%     13.9µs ± 1%   -0.69%  (p=0.003 n=10+10)
      CompileOnepass/^.bc(d|e)*$-6                8.96µs ± 1%     9.06µs ± 1%   +1.20%  (p=0.000 n=10+9)
      CompileOnepass/^loooooooooooooooooo...-6     219µs ± 1%      220µs ± 1%   +0.63%  (p=0.006 n=9+10)
      [Geo mean]                                  31.6µs          31.1µs        -1.82%
      
      name                                      old speed      new speed       delta
      QuoteMetaAll-6                            65.5MB/s ± 2%   64.8MB/s ± 3%     ~     (p=0.315 n=10+10)
      QuoteMetaNone-6                            290MB/s ± 1%    290MB/s ± 1%     ~     (p=0.755 n=10+10)
      Match/Easy0/32-6                           250MB/s ± 0%    251MB/s ± 1%     ~     (p=0.277 n=8+9)
      Match/Easy0/1K-6                          1.81GB/s ± 0%   1.81GB/s ± 0%     ~     (p=0.408 n=8+10)
      Match/Easy0/32K-6                         3.52GB/s ± 1%   3.53GB/s ± 1%     ~     (p=0.529 n=10+10)
      Match/Easy0/1M-6                          2.28GB/s ± 1%   2.28GB/s ± 1%     ~     (p=0.853 n=10+10)
      Match/Easy0/32M-6                         2.24GB/s ± 0%   2.23GB/s ± 0%   -0.76%  (p=0.000 n=9+8)
      Match/Easy0i/32-6                         15.2MB/s ± 1%   16.2MB/s ± 0%   +6.43%  (p=0.000 n=10+9)
      Match/Easy0i/1K-6                         16.6MB/s ± 0%   17.9MB/s ± 0%   +7.48%  (p=0.000 n=10+9)
      Match/Easy0i/32K-6                        11.9MB/s ± 0%   12.0MB/s ± 0%   +1.11%  (p=0.000 n=9+9)
      Match/Easy0i/1M-6                         11.9MB/s ± 0%   12.1MB/s ± 1%   +1.31%  (p=0.000 n=8+10)
      Match/Easy0i/32M-6                        11.9MB/s ± 0%   12.1MB/s ± 1%   +1.84%  (p=0.000 n=8+10)
      Match/Easy1/32-6                           260MB/s ± 1%    258MB/s ± 1%   -0.91%  (p=0.001 n=10+10)
      Match/Easy1/1K-6                           601MB/s ± 1%    621MB/s ± 0%   +3.28%  (p=0.000 n=9+10)
      Match/Easy1/32K-6                          474MB/s ± 0%    479MB/s ± 1%   +0.96%  (p=0.000 n=8+10)
      Match/Easy1/1M-6                           426MB/s ± 1%    433MB/s ± 1%   +1.68%  (p=0.000 n=10+10)
      Match/Easy1/32M-6                          428MB/s ± 1%    433MB/s ± 0%   +1.09%  (p=0.000 n=10+9)
      Match/Medium/32-6                         15.4MB/s ± 1%   16.7MB/s ± 1%   +8.23%  (p=0.000 n=10+9)
      Match/Medium/1K-6                         16.3MB/s ± 1%   17.7MB/s ± 1%   +8.43%  (p=0.000 n=9+10)
      Match/Medium/32K-6                        12.5MB/s ± 1%   12.7MB/s ± 1%   +2.15%  (p=0.000 n=10+10)
      Match/Medium/1M-6                         12.4MB/s ± 0%   12.7MB/s ± 0%   +2.44%  (p=0.000 n=8+9)
      Match/Medium/32M-6                        12.4MB/s ± 0%   12.7MB/s ± 0%   +2.52%  (p=0.000 n=10+9)
      Match/Hard/32-6                           9.82MB/s ± 1%  10.73MB/s ± 1%   +9.29%  (p=0.000 n=10+10)
      Match/Hard/1K-6                           10.2MB/s ± 0%   11.3MB/s ± 1%  +10.56%  (p=0.000 n=9+10)
      Match/Hard/32K-6                          8.58MB/s ± 0%   8.58MB/s ± 1%     ~     (p=0.554 n=8+10)
      Match/Hard/1M-6                           8.59MB/s ± 1%   8.53MB/s ± 0%   -0.70%  (p=0.000 n=10+8)
      Match/Hard/32M-6                          8.62MB/s ± 1%   8.59MB/s ± 1%     ~     (p=0.098 n=10+10)
      Match/Hard1/32-6                          1.77MB/s ± 1%   1.99MB/s ± 1%  +12.40%  (p=0.000 n=10+8)
      Match/Hard1/1K-6                          1.81MB/s ± 1%   2.08MB/s ± 1%  +14.55%  (p=0.000 n=10+10)
      Match/Hard1/32K-6                         1.74MB/s ± 0%   1.74MB/s ± 0%     ~     (p=0.108 n=9+10)
      Match/Hard1/1M-6                          1.74MB/s ± 0%   1.74MB/s ± 1%     ~     (p=1.000 n=9+10)
      Match/Hard1/32M-6                         1.75MB/s ± 0%   1.75MB/s ± 1%     ~     (p=0.157 n=9+10)
      Match_onepass_regex/32-6                  5.05MB/s ± 0%   5.05MB/s ± 1%     ~     (p=0.262 n=8+10)
      Match_onepass_regex/1K-6                  5.02MB/s ± 1%   5.02MB/s ± 1%     ~     (p=0.677 n=9+10)
      Match_onepass_regex/32K-6                 5.02MB/s ± 0%   4.99MB/s ± 0%   -0.47%  (p=0.000 n=10+9)
      Match_onepass_regex/1M-6                  5.01MB/s ± 0%   5.04MB/s ± 1%   +0.68%  (p=0.017 n=8+10)
      Match_onepass_regex/32M-6                 4.99MB/s ± 0%   5.03MB/s ± 1%   +0.74%  (p=0.000 n=10+10)
      [Geo mean]                                29.1MB/s        29.8MB/s        +2.44%
      
      go1 data for reference
      
      name                     old time/op    new time/op    delta
      BinaryTree17-6              4.39s ± 1%     4.37s ± 0%   -0.58%  (p=0.006 n=9+9)
      Fannkuch11-6                5.13s ± 0%     5.18s ± 0%   +0.87%  (p=0.000 n=8+8)
      FmtFprintfEmpty-6          74.2ns ± 0%    71.7ns ± 3%   -3.41%  (p=0.000 n=10+10)
      FmtFprintfString-6          120ns ± 1%     122ns ± 2%     ~     (p=0.333 n=10+10)
      FmtFprintfInt-6             127ns ± 1%     127ns ± 1%     ~     (p=0.809 n=10+10)
      FmtFprintfIntInt-6          186ns ± 0%     188ns ± 1%   +1.02%  (p=0.002 n=8+10)
      FmtFprintfPrefixedInt-6     223ns ± 1%     222ns ± 2%     ~     (p=0.421 n=10+10)
      FmtFprintfFloat-6           374ns ± 0%     376ns ± 1%   +0.43%  (p=0.030 n=8+10)
      FmtManyArgs-6               795ns ± 0%     788ns ± 1%   -0.79%  (p=0.000 n=8+9)
      GobDecode-6                10.9ms ± 1%    10.9ms ± 0%     ~     (p=0.079 n=10+9)
      GobEncode-6                8.60ms ± 1%    8.56ms ± 0%   -0.52%  (p=0.004 n=10+10)
      Gzip-6                      378ms ± 1%     386ms ± 1%   +2.28%  (p=0.000 n=10+10)
      Gunzip-6                   63.7ms ± 0%    62.3ms ± 0%   -2.22%  (p=0.000 n=9+8)
      HTTPClientServer-6          120µs ± 3%     114µs ± 3%   -4.99%  (p=0.000 n=10+10)
      JSONEncode-6               20.3ms ± 1%    19.9ms ± 0%   -1.90%  (p=0.000 n=9+10)
      JSONDecode-6               84.3ms ± 0%    83.7ms ± 0%   -0.76%  (p=0.000 n=8+8)
      Mandelbrot200-6            6.91ms ± 0%    6.89ms ± 0%   -0.31%  (p=0.000 n=9+8)
      GoParse-6                  5.49ms ± 0%    5.47ms ± 1%     ~     (p=0.101 n=8+10)
      RegexpMatchEasy0_32-6       130ns ± 0%     128ns ± 0%   -1.54%  (p=0.002 n=8+10)
      RegexpMatchEasy0_1K-6       322ns ± 1%     322ns ± 0%     ~     (p=0.525 n=10+9)
      RegexpMatchEasy1_32-6       124ns ± 0%     124ns ± 0%   -0.32%  (p=0.046 n=8+10)
      RegexpMatchEasy1_1K-6       570ns ± 0%     548ns ± 1%   -3.76%  (p=0.000 n=10+10)
      RegexpMatchMedium_32-6      196ns ± 0%     183ns ± 1%   -6.61%  (p=0.000 n=8+10)
      RegexpMatchMedium_1K-6     64.3µs ± 0%    59.0µs ± 1%   -8.31%  (p=0.000 n=8+10)
      RegexpMatchHard_32-6       3.08µs ± 0%    2.80µs ± 0%   -8.96%  (p=0.000 n=8+9)
      RegexpMatchHard_1K-6       93.0µs ± 0%    84.5µs ± 1%   -9.17%  (p=0.000 n=8+9)
      Revcomp-6                   647ms ± 2%     646ms ± 1%     ~     (p=0.720 n=10+9)
      Template-6                 92.3ms ± 0%    91.7ms ± 0%   -0.65%  (p=0.000 n=8+8)
      TimeParse-6                 490ns ± 0%     488ns ± 0%   -0.43%  (p=0.000 n=10+10)
      TimeFormat-6                513ns ± 0%     513ns ± 1%     ~     (p=0.144 n=9+10)
      [Geo mean]                 79.1µs         77.7µs        -1.73%
      
      name                     old speed      new speed      delta
      GobDecode-6              70.1MB/s ± 1%  70.3MB/s ± 0%     ~     (p=0.078 n=10+9)
      GobEncode-6              89.2MB/s ± 1%  89.7MB/s ± 0%   +0.52%  (p=0.004 n=10+10)
      Gzip-6                   51.4MB/s ± 1%  50.2MB/s ± 1%   -2.23%  (p=0.000 n=10+10)
      Gunzip-6                  304MB/s ± 0%   311MB/s ± 0%   +2.27%  (p=0.000 n=9+8)
      JSONEncode-6             95.8MB/s ± 1%  97.7MB/s ± 0%   +1.93%  (p=0.000 n=9+10)
      JSONDecode-6             23.0MB/s ± 0%  23.2MB/s ± 0%   +0.76%  (p=0.000 n=8+8)
      GoParse-6                10.6MB/s ± 0%  10.6MB/s ± 1%     ~     (p=0.111 n=8+10)
      RegexpMatchEasy0_32-6     244MB/s ± 0%   249MB/s ± 0%   +2.06%  (p=0.000 n=9+10)
      RegexpMatchEasy0_1K-6    3.18GB/s ± 1%  3.17GB/s ± 0%     ~     (p=0.211 n=10+9)
      RegexpMatchEasy1_32-6     257MB/s ± 0%   258MB/s ± 0%   +0.37%  (p=0.000 n=8+8)
      RegexpMatchEasy1_1K-6    1.80GB/s ± 0%  1.87GB/s ± 1%   +3.91%  (p=0.000 n=10+10)
      RegexpMatchMedium_32-6   5.08MB/s ± 0%  5.43MB/s ± 1%   +7.03%  (p=0.000 n=8+10)
      RegexpMatchMedium_1K-6   15.9MB/s ± 0%  17.4MB/s ± 1%   +9.08%  (p=0.000 n=8+10)
      RegexpMatchHard_32-6     10.4MB/s ± 0%  11.4MB/s ± 0%   +9.82%  (p=0.000 n=8+9)
      RegexpMatchHard_1K-6     11.0MB/s ± 0%  12.1MB/s ± 1%  +10.10%  (p=0.000 n=8+9)
      Revcomp-6                 393MB/s ± 2%   394MB/s ± 1%     ~     (p=0.720 n=10+9)
      Template-6               21.0MB/s ± 0%  21.2MB/s ± 0%   +0.66%  (p=0.000 n=8+8)
      [Geo mean]               74.2MB/s       76.2MB/s        +2.70%
      
      Updates #21851
      
      Change-Id: Ie88455db925f422a828f8528293790726a9c036b
      Reviewed-on: https://go-review.googlesource.com/65491
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1ae67965
    • Keith Randall's avatar
      cmd/compile: improve static map initialization · 91cb9edd
      Keith Randall authored
      When static maps are large, we try to initialize them
      by iterating over an array of key/value pairs.
      
      Currently this optimization only works if the keys and values
      are of primitive type.  This CL improves this optimization
      by allowing any static composite literals as well.
      
      Fixes #22010
      
      Change-Id: Ie493e02ab8b8a228a3472b5c6025a33f7b92daf3
      Reviewed-on: https://go-review.googlesource.com/66050
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      91cb9edd
    • Gabriel Aszalos's avatar
      strings: improve readability of IndexAny and LastIndexAny functions. · c82ee792
      Gabriel Aszalos authored
      This change removes the check of len(chars) > 0 inside the Index and
      IndexAny functions which was redundant.
      
      Change-Id: Iffbc0f2b3332c6e31c7514b5f644b6fe7bdcfe0d
      Reviewed-on: https://go-review.googlesource.com/65910
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJoe Tsai <thebrokentoaster@gmail.com>
      c82ee792
    • Wei Congrui's avatar
      path/filepath: ensure Walk report unreadable directories once · 5db7572d
      Wei Congrui authored
      Before this change, if Walk encounters an unreadable directory,
      it will call walkFn with this directory twice. Argument err in
      the first call is nil, and the second is the permission error.
      
      This change removes the former call and makes Walk call walkFn
      with permission error.
      
      Fixes #21758
      
      Change-Id: I21e57c67f3c5a8370fc80a43db3c8009fbce6439
      Reviewed-on: https://go-review.googlesource.com/63994
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      5db7572d
    • Gabriel Aszalos's avatar
      bytes: improve readability of IndexAny and LastIndexAny functions · b71f3961
      Gabriel Aszalos authored
      This change removes the check of len(chars) > 0 inside the Index and
      IndexAny functions which was redundant.
      
      Change-Id: Ic4bf8b8a37d7f040d3ebd81b4fc45fcb386b639a
      Reviewed-on: https://go-review.googlesource.com/65851
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b71f3961
    • Marvin Stenger's avatar
      all: prefer strings.IndexByte over strings.Index · f22ba1f2
      Marvin Stenger authored
      strings.IndexByte was introduced in go1.2 and it can be used
      effectively wherever the second argument to strings.Index is
      exactly one byte long.
      
      This avoids generating unnecessary string symbols and saves
      a few calls to strings.Index.
      
      Change-Id: I1ab5edb7c4ee9058084cfa57cbcc267c2597e793
      Reviewed-on: https://go-review.googlesource.com/65930
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      f22ba1f2
    • Alessandro Arzilli's avatar
      runtime: fix TestGdbConst on windows · 5e92c411
      Alessandro Arzilli authored
      Some (all?) versions of gdb on windows output "\r\n" as line ending
      instead of "\n".
      
      Fixes #22012
      
      Change-Id: I798204fd9f616d6d2c9c28eb5227fadfc63c0d45
      Reviewed-on: https://go-review.googlesource.com/65850Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5e92c411
    • griesemer's avatar
      go/types: don't accept incorrect shift expression arguments · 45395b5a
      griesemer authored
      Under certain circumstances involving shifts, go/types didn't verify
      that untyped constant values were representable by the relevant type,
      leading to the acceptance of incorrect programs (see the issue).
      
      Fixing this code exposed another problem with int-to-string conversions
      which suddenly failed because now the type-checker complained that a
      (constant) integer argument wasn't representable as a string. Fixed that
      as well.
      
      Added many additional tests covering the various scenarious.
      
      Found two cmd/compile bugs in the process (#21979, #21981) and filed
      a go/types TODO (#21982).
      
      Fixes #21727.
      
      Change-Id: If443ee0230979cd7d45d2fc669e623648caa70da
      Reviewed-on: https://go-review.googlesource.com/65370Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      45395b5a
    • Daniel Martí's avatar
      cmd/compile: merge bytes inline test with the rest · 6945c67e
      Daniel Martí authored
      In golang.org/cl/42813, a test was added in the bytes package to check
      if a Buffer method was being inlined, using 'go tool nm'.
      
      Now that we have a compiler test that verifies that certain funcs are
      inlineable, merge it there. Knowing whether the funcs are inlineable is
      also more reliable than whether or not their symbol appears in the
      binary, too. For example, under some circumstances, inlineable funcs
      can't be inlined, such as if closures are used.
      
      While at it, add a few more bytes.Buffer methods that are currently
      inlined and should clearly stay that way.
      
      Updates #21851.
      
      Change-Id: I62066e32ef5542d37908bd64f90bda51276da4de
      Reviewed-on: https://go-review.googlesource.com/65658
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarMarvin Stenger <marvin.stenger94@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6945c67e
    • Daniel Martí's avatar
      cmd/compile: refactor some more gotos away · 0168fdb5
      Daniel Martí authored
      The ones in racewalk.go are almost all useless, since they were just
      breaks.
      
      typecheck.go wasn't trivial, but still doable with an if/else chain.
      
      Also remove a single silly goto in const.go, while at it.
      
      Change-Id: I776a78df6bb3b6bd4f7e5feec546c772baf4e02e
      Reviewed-on: https://go-review.googlesource.com/65652
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      0168fdb5
  3. 24 Sep, 2017 8 commits
  4. 23 Sep, 2017 6 commits
  5. 22 Sep, 2017 10 commits
    • Austin Clements's avatar
      runtime: hide <autogenerated> methods from call stack · e9720951
      Austin Clements authored
      The compiler generates wrapper methods to forward interface method
      calls (which are always pointer-based) to value methods. These
      wrappers appear in the call stack even though they are an
      implementation detail. This leaves ugly "<autogenerated>" functions in
      stack traces and can throw off skip counts for stack traces.
      
      Fix this by considering these runtime frames in printed stack traces
      so they will only be printed if runtime frames are being printed, and
      by eliding them from the call stack expansion used by CallersFrames
      and Caller.
      
      This removes the test for issue 4388 since that was checking that
      "<autogenerated>" appeared in the stack trace instead of something
      even weirder. We replace it with various runtime package tests.
      
      Fixes #16723.
      
      Change-Id: Ice3f118c66f254bb71478a664d62ab3fc7125819
      Reviewed-on: https://go-review.googlesource.com/45412
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      e9720951
    • Austin Clements's avatar
      runtime: simplify stack walk in panicwrap · 354fa9a8
      Austin Clements authored
      panicwrap currently uses runtime.Callers and runtime.CallersFrames to
      find the name of its caller. Simplify this by using getcallerpc.
      
      This will be important for #16723, since to fix that we're going to
      make CallersFrames skip the wrapper method, which is exactly what
      panicwrap needs to see.
      
      Change-Id: Icb0776d399966e31595f3ee44f980290827e32a6
      Reviewed-on: https://go-review.googlesource.com/45411
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      354fa9a8
    • Austin Clements's avatar
      runtime: remove getcallerpc argument · 229aaac1
      Austin Clements authored
      Now that getcallerpc is a compiler intrinsic on x86 and non-x86
      platforms don't need the argument, we can drop it.
      
      Sadly, this doesn't let us remove any dummy arguments since all of
      those cases also use getcallersp, which still takes the argument
      pointer, but this is at least an improvement.
      
      Change-Id: I9c34a41cf2c18cba57f59938390bf9491efb22d2
      Reviewed-on: https://go-review.googlesource.com/65474
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      229aaac1
    • Ian Lance Taylor's avatar
      os/exec: remove protection against simultaneous Wait/Write · 8cb2952f
      Ian Lance Taylor authored
      CL 31148 added code to protect again simultaneous calls to Close and
      Wait when using the standard input pipe, to fix the race condition
      described in issue #9307. That issue is a special case of the race
      between Close and Write described by issue #7970. Since issue #7970
      was not fixed, CL 31148 fixed the problem specific to os/exec.
      
      Since then, issue #7970 has been fixed, so the specific fix in os/exec
      is no longer necessary. Remove it, effectively reverting CL 31148 and
      followup CL 33298.
      
      Updates #7970
      Updates #9307
      Updates #17647
      
      Change-Id: Ic0b62569cb0aba44b32153cf5f9632bd1f1b411a
      Reviewed-on: https://go-review.googlesource.com/65490
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      Reviewed-by: default avatarMiguel Bernabeu <miguelbernadi@gmail.com>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Reviewed-by: default avatarJoe Tsai <joetsai@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8cb2952f
    • Austin Clements's avatar
      runtime: re-add sanity check for GCCPUFraction · 4c02eaf7
      Austin Clements authored
      This no longer appears to be reproducible on windows/386. Try putting
      it back and we'll see if the builders still don't like it.
      
      Fixes #19319.
      
      Change-Id: Ia47b034e18d0a5a1951125c00542b021aacd5e8d
      Reviewed-on: https://go-review.googlesource.com/47936
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      4c02eaf7
    • David Chase's avatar
      cmd/compile: add intrinsic for reading caller's pc · 6cac100e
      David Chase authored
      First step towards removing the mandatory argument for
      getcallerpc, which solves certain problems for the runtime.
      This might also slightly improve performance.
      
      Intrinsic enabled on 386, amd64, amd64p32,
      runtime asm implementation removed on those architectures.
      
      Now-superfluous argument remains in getcallerpc signature
      (for a future CL; non-386/amd64 asm funcs ignore it).
      
      Added getcallerpc to the "not a real function" test
      in dcl.go, that story is a little odd with respect to
      unexported functions but that is not this CL.
      
      Fixes #17327.
      
      Change-Id: I5df1ad91f27ee9ac1f0dd88fa48f1329d6306c3e
      Reviewed-on: https://go-review.googlesource.com/31851
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      6cac100e
    • Ian Lance Taylor's avatar
      runtime: don't call lockOSThread for every cgo call · 332719f7
      Ian Lance Taylor authored
      For a trivial benchmark with a do-nothing cgo call:
      
      name    old time/op  new time/op  delta
      Call-4  64.5ns ± 7%  63.0ns ± 6%  -2.25%  (p=0.027 n=20+16)
      
      Because Windows uses the cgocall mechanism to make system calls,
      and passes arguments in a struct held in the m,
      we need to do the lockOSThread/unlockOSThread in that code.
      
      Because deferreturn was getting a nosplit stack overflow error,
      change it to avoid calling typedmemmove.
      
      Updates #21827.
      
      Change-Id: I9b1d61434c44faeb29805b46b409c812c9acadc2
      Reviewed-on: https://go-review.googlesource.com/64070
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      332719f7
    • Alessandro Arzilli's avatar
      cmd/compile,cmd/link: export int global consts to DWARF · 9daee931
      Alessandro Arzilli authored
      Updates #14517
      
      Change-Id: I23ef88e71c89da12dffcadf5562ea2d7557b62cf
      Reviewed-on: https://go-review.googlesource.com/61019Reviewed-by: default avatarAustin Clements <austin@google.com>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9daee931
    • Daniel Martí's avatar
      cmd/compile: add more runtime funcs to inline test · f366379d
      Daniel Martí authored
      This is based from a list that Keith Randall provided in mid-2016. These
      are all funcs that, at the time, were important and small enough that
      they should be clearly inlined.
      
      The runtime has changed a bit since then. Ctz16 and Ctz8 were removed,
      so don't add them. stringtoslicebytetmp was moved to the backend, so
      it's no longer a Go function. And itabhash was moved to itabHashFunc.
      
      The only other outlier is adjustctxt, which is not inlineable at the
      moment. I've added a TODO and will address it myself in a separate
      commit.
      
      While at it, error if any funcs in the input table are duplicated.
      They're never useful and typos could lead to unintentionally thinking a
      function is inlineable when it actually isn't.
      
      And, since the lists are getting long, start sorting alphabetically.
      
      Finally, rotl_31 is only defined on 64-bit architectures, and the added
      runtime/internal/sys funcs are assembly on 386 and thus non-inlineable
      in that case.
      
      Updates #21851.
      
      Change-Id: Ib99ab53d777860270e8fd4aefc41adb448f13662
      Reviewed-on: https://go-review.googlesource.com/65351
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f366379d
    • Daniel Martí's avatar
      cmd/compile: remove unused cases from switch · 6db69795
      Daniel Martí authored
      The first just falls through, and the default case does nothing. They
      can be deleted.
      
      Change-Id: I82ab1ce3acde0b8423334cfbf35f9e0c806cd494
      Reviewed-on: https://go-review.googlesource.com/65410Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6db69795