]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years agocmd/compile: use a bytes.Buffer to format symbols
Josh Bleecher Snyder [Wed, 15 Jan 2020 00:37:42 +0000 (16:37 -0800)]
cmd/compile: use a bytes.Buffer to format symbols

No significant compiler speed changes,
but some minor memory savings.

Passes toolstash-check.

name        old alloc/op      new alloc/op      delta
Template         36.3MB ± 0%       36.2MB ± 0%  -0.25%  (p=0.008 n=5+5)
Unicode          28.3MB ± 0%       28.2MB ± 0%  -0.16%  (p=0.008 n=5+5)
GoTypes           122MB ± 0%        121MB ± 0%  -0.39%  (p=0.008 n=5+5)
Compiler          568MB ± 0%        566MB ± 0%  -0.21%  (p=0.008 n=5+5)
SSA              1.95GB ± 0%       1.95GB ± 0%  -0.08%  (p=0.008 n=5+5)
Flate            22.8MB ± 0%       22.8MB ± 0%  -0.21%  (p=0.008 n=5+5)
GoParser         28.0MB ± 0%       27.9MB ± 0%  -0.38%  (p=0.008 n=5+5)
Reflect          78.6MB ± 0%       78.3MB ± 0%  -0.33%  (p=0.008 n=5+5)
Tar              34.1MB ± 0%       34.1MB ± 0%  -0.19%  (p=0.008 n=5+5)
XML              44.3MB ± 0%       44.2MB ± 0%  -0.19%  (p=0.008 n=5+5)
[Geo mean]       79.9MB            79.7MB       -0.24%

name        old allocs/op     new allocs/op     delta
Template           363k ± 0%         359k ± 0%  -1.21%  (p=0.008 n=5+5)
Unicode            329k ± 0%         326k ± 0%  -0.90%  (p=0.008 n=5+5)
GoTypes           1.28M ± 0%        1.25M ± 0%  -2.62%  (p=0.008 n=5+5)
Compiler          5.39M ± 0%        5.31M ± 0%  -1.45%  (p=0.008 n=5+5)
SSA               18.1M ± 0%        17.9M ± 0%  -0.78%  (p=0.008 n=5+5)
Flate              228k ± 0%         226k ± 0%  -0.97%  (p=0.008 n=5+5)
GoParser           295k ± 0%         288k ± 0%  -2.26%  (p=0.008 n=5+5)
Reflect            949k ± 0%         932k ± 0%  -1.74%  (p=0.008 n=5+5)
Tar                336k ± 0%         332k ± 0%  -1.12%  (p=0.008 n=5+5)
XML                417k ± 0%         413k ± 0%  -1.10%  (p=0.008 n=5+5)
[Geo mean]         818k              806k       -1.42%

Change-Id: Ibdb94650a761edec17d8eba0abdfb70a8a495da9
Reviewed-on: https://go-review.googlesource.com/c/go/+/222920
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agocmd/compile: fix buggy AMD64 rewrite from CL 213058
Russ Cox [Wed, 11 Mar 2020 04:02:04 +0000 (00:02 -0400)]
cmd/compile: fix buggy AMD64 rewrite from CL 213058

CL 213058's "bonus optimization I noticed while working on this"
turns out to be buggy. It would be correct for CMP, but not TEST.
Fix it to use TEST semantics instead.

This was breaking compilation with the upcoming Spectre mode.

Change-Id: If2d4c3798ed182f35f0244febe74e68c61e4c61b
Reviewed-on: https://go-review.googlesource.com/c/go/+/222853
Reviewed-by: Keith Randall <khr@golang.org>
5 years agotest/run: handle asmcheck -gcflags= commands better
Russ Cox [Tue, 10 Mar 2020 17:45:19 +0000 (13:45 -0400)]
test/run: handle asmcheck -gcflags= commands better

The default is for later flags to override earlier ones,
so if the asmcheck set flags, it lost the important -S=2.

Change-Id: Id538254908d658da2acb55157ac4f6fa44f6a467
Reviewed-on: https://go-review.googlesource.com/c/go/+/222820
Reviewed-by: Keith Randall <khr@golang.org>
5 years agotest/codegen: mention in README that tests only run on Linux without -all_codegen
Russ Cox [Tue, 10 Mar 2020 17:31:15 +0000 (13:31 -0400)]
test/codegen: mention in README that tests only run on Linux without -all_codegen

This took me a while to figure out. The relevant code is in
test/run.go (note the "linux" hard-coded strings):

var arch, subarch, os string
switch {
case archspec[2] != "": // 3 components: "linux/386/sse2"
os, arch, subarch = archspec[0], archspec[1][1:], archspec[2][1:]
case archspec[1] != "": // 2 components: "386/sse2"
os, arch, subarch = "linux", archspec[0], archspec[1][1:]
default: // 1 component: "386"
os, arch, subarch = "linux", archspec[0], ""
if arch == "wasm" {
os = "js"
}
}

Change-Id: I92ba280025d2072e17532a5e43cf1d676789c167
Reviewed-on: https://go-review.googlesource.com/c/go/+/222819
Reviewed-by: Keith Randall <khr@golang.org>
5 years agonet/http: use t.Deadline instead of an arbitrary timeout in TestServerConnState
Bryan C. Mills [Wed, 11 Mar 2020 14:24:14 +0000 (10:24 -0400)]
net/http: use t.Deadline instead of an arbitrary timeout in TestServerConnState

Updates #37322

Change-Id: I3b8369cd9e0ed5e4b3136cedaa2f70698ead2270
Reviewed-on: https://go-review.googlesource.com/c/go/+/222957
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
5 years agoruntime: skip TestSignalIgnoreSIGTRAP on known-flaky OpenBSD builders
Bryan C. Mills [Wed, 11 Mar 2020 13:39:54 +0000 (09:39 -0400)]
runtime: skip TestSignalIgnoreSIGTRAP on known-flaky OpenBSD builders

This test is flaky, and the cause is suspected to be an OpenBSD kernel bug.
Since there is no obvious workaround on the Go side, skip the test on
builders whose versions are known to be affected.

Fixes #17496

Change-Id: Ifa70061eb429e1d949f0fa8a9e25d177afc5c488
Reviewed-on: https://go-review.googlesource.com/c/go/+/222856
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
5 years agocmd/compile: improve CFG size in ssa.html
Josh Bleecher Snyder [Sat, 7 Mar 2020 21:36:36 +0000 (13:36 -0800)]
cmd/compile: improve CFG size in ssa.html

This change forces CFGs to take the full width of their column
and allows them to be as tall as necessary.

In my (recent) experience, this makes them far less likely to
be cropped, which makes them much more useful.

On rare occasions, this can lead to gigantic CFGs,
but if you've bothered to explicitly request a CFG,
this is still better than an irrevocably truncated CFG.

Change-Id: I9a649ea57fa3c2792998bb71331a2580e429b36a
Reviewed-on: https://go-review.googlesource.com/c/go/+/222618
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agotest: fix issue 15992 test wrong function call
Cuong Manh Le [Wed, 5 Feb 2020 03:32:44 +0000 (10:32 +0700)]
test: fix issue 15992 test wrong function call

Change-Id: I623ae5faffce456b34d97a2a0aa277ecbf1990f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/217699
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agostrings, bytes: improve IndexAny and LastIndexAny performance
erifan01 [Sun, 23 Dec 2018 02:15:44 +0000 (02:15 +0000)]
strings, bytes: improve IndexAny and LastIndexAny performance

For the case of a pattern containing multi-byte rune, the time complexity of the
previous algorithm is O(nm), and if both input arguments are long, the search
performance will be poor. This CL improves the searching performance for these
cases by using IndexRune, which is mainly implemented with IndexByte and Index.
As IndexByte and Index are specially optimized with some powerful instructions
for short patterns (an UTF8 rune is 1 to 4 bytes), so they can help to reduce the
runtime complexity of IndexAny and LastIndexAny.

Another optimization method is using hash table, however, the actual test results
show that using indexrune is better, and the space complexity is lower.

There are two fast paths in IndexAny and LastIndexAny for cases where the length
of the input arguements are 1, and their locations are not exactly the same, which
is determined based on the actual test results.

Benchmarks on arm64 and amd64:

name                        old time/op  new time/op  delta
pkg:strings goos:linux goarch:arm64
IndexAnyASCII/1:1-8         23.7ns ± 3%  28.5ns ± 0%  +20.15%  (p=0.008 n=5+5)
IndexAnyASCII/1:2-8         18.0ns ± 0%  33.1ns ± 0%  +83.67%  (p=0.008 n=5+5)
IndexAnyASCII/1:4-8         20.0ns ± 0%  36.0ns ± 0%  +80.00%  (p=0.029 n=4+4)
IndexAnyASCII/1:8-8         36.1ns ± 0%  36.0ns ± 0%     ~     (p=0.095 n=5+4)
IndexAnyASCII/1:16-8        48.1ns ± 0%  36.0ns ± 0%  -25.19%  (p=0.029 n=4+4)
IndexAnyASCII/1:32-8        72.1ns ± 0%  36.0ns ± 0%  -50.01%  (p=0.008 n=5+5)
IndexAnyASCII/1:64-8         120ns ± 0%    39ns ± 0%  -67.83%  (p=0.008 n=5+5)
IndexAnyASCII/16:1-8        73.0ns ± 0%  28.5ns ± 0%  -60.95%  (p=0.008 n=5+5)
IndexAnyASCII/16:2-8        76.8ns ± 0%  77.0ns ± 0%     ~     (p=1.000 n=5+5)
IndexAnyASCII/16:4-8        83.2ns ± 1%  83.0ns ± 0%     ~     (p=0.770 n=5+5)
IndexAnyASCII/16:8-8         111ns ± 1%   107ns ± 0%   -3.25%  (p=0.008 n=5+5)
IndexAnyASCII/16:16-8        139ns ± 1%   137ns ± 0%   -1.58%  (p=0.008 n=5+5)
IndexAnyASCII/16:32-8        199ns ± 1%   197ns ± 0%   -1.20%  (p=0.008 n=5+5)
IndexAnyASCII/16:64-8        307ns ± 0%   313ns ± 0%   +1.82%  (p=0.016 n=5+4)
IndexAnyASCII/256:1-8        674ns ± 0%    65ns ± 0%  -90.31%  (p=0.008 n=5+5)
IndexAnyASCII/256:2-8        678ns ± 0%   683ns ± 0%   +0.68%  (p=0.008 n=5+5)
IndexAnyASCII/256:4-8        685ns ± 0%   683ns ± 0%   -0.29%  (p=0.000 n=5+4)
IndexAnyASCII/256:8-8        711ns ± 0%   708ns ± 0%   -0.48%  (p=0.008 n=5+5)
IndexAnyASCII/256:16-8       740ns ± 0%   740ns ± 0%     ~     (p=0.444 n=5+5)
IndexAnyASCII/256:32-8       799ns ± 0%   798ns ± 0%   -0.18%  (p=0.008 n=5+5)
IndexAnyASCII/256:64-8       910ns ± 0%   914ns ± 0%   +0.44%  (p=0.016 n=4+5)
IndexAnyUTF8/1:1-8          27.1ns ± 0%  19.0ns ± 0%  -29.79%  (p=0.008 n=5+5)
IndexAnyUTF8/1:2-8          44.1ns ± 0%  33.0ns ± 0%  -25.17%  (p=0.008 n=5+5)
IndexAnyUTF8/1:4-8          46.1ns ± 0%  33.1ns ± 0%  -28.29%  (p=0.016 n=4+5)
IndexAnyUTF8/1:8-8          85.1ns ± 0%  33.0ns ± 0%  -61.18%  (p=0.008 n=5+5)
IndexAnyUTF8/1:16-8          110ns ± 1%    36ns ± 0%  -67.27%  (p=0.008 n=5+5)
IndexAnyUTF8/1:32-8          188ns ± 0%    36ns ± 0%  -80.85%  (p=0.008 n=5+5)
IndexAnyUTF8/1:64-8          332ns ± 0%    39ns ± 0%     ~     (p=0.079 n=4+5)
IndexAnyUTF8/16:1-8          293ns ± 0%    54ns ± 0%  -81.56%  (p=0.008 n=5+5)
IndexAnyUTF8/16:2-8          563ns ± 0%   349ns ± 0%  -37.98%  (p=0.008 n=5+5)
IndexAnyUTF8/16:4-8          546ns ± 1%   349ns ± 0%  -36.10%  (p=0.000 n=5+4)
IndexAnyUTF8/16:8-8         1.22µs ± 0%  0.35µs ± 0%  -71.39%  (p=0.008 n=5+5)
IndexAnyUTF8/16:16-8        1.63µs ± 1%  0.42µs ± 0%  -73.98%  (p=0.008 n=5+5)
IndexAnyUTF8/16:32-8        2.87µs ± 0%  0.42µs ± 0%  -85.22%  (p=0.008 n=5+5)
IndexAnyUTF8/16:64-8        5.18µs ± 0%  0.47µs ± 0%  -90.98%  (p=0.008 n=5+5)
IndexAnyUTF8/256:1-8        4.26µs ± 0%  0.47µs ± 0%  -88.85%  (p=0.000 n=4+5)
IndexAnyUTF8/256:2-8        8.62µs ± 0%  5.15µs ± 0%  -40.21%  (p=0.008 n=5+5)
IndexAnyUTF8/256:4-8        8.25µs ± 0%  5.15µs ± 0%  -37.50%  (p=0.016 n=5+4)
IndexAnyUTF8/256:8-8        19.2µs ± 1%   5.2µs ± 0%  -73.08%  (p=0.016 n=5+4)
IndexAnyUTF8/256:16-8       25.6µs ± 1%   6.3µs ± 0%  -75.32%  (p=0.008 n=5+5)
IndexAnyUTF8/256:32-8       45.6µs ± 0%   6.3µs ± 0%  -86.15%  (p=0.008 n=5+5)
IndexAnyUTF8/256:64-8       82.4µs ± 0%   7.0µs ± 0%  -91.53%  (p=0.016 n=5+4)
LastIndexAnyASCII/1:1-8     23.0ns ± 0%  33.5ns ± 0%  +45.65%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:2-8     24.5ns ± 0%  33.5ns ± 0%  +36.73%  (p=0.016 n=4+5)
LastIndexAnyASCII/1:4-8     27.5ns ± 0%  35.5ns ± 0%  +29.09%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:8-8     44.5ns ± 0%  35.5ns ± 0%  -20.13%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:16-8    56.5ns ± 0%  35.5ns ± 0%  -37.15%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:32-8    80.3ns ± 0%  35.5ns ± 0%  -55.79%  (p=0.000 n=5+4)
LastIndexAnyASCII/1:64-8     129ns ± 0%    40ns ± 0%  -68.85%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:1-8    72.8ns ± 0%  72.7ns ± 0%   -0.19%  (p=0.016 n=4+5)
LastIndexAnyASCII/16:2-8    75.4ns ± 0%  75.1ns ± 0%     ~     (p=0.127 n=5+5)
LastIndexAnyASCII/16:4-8    81.9ns ± 1%  80.2ns ± 0%   -2.00%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:8-8     110ns ± 1%   108ns ± 0%   -1.46%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:16-8    138ns ± 1%   134ns ± 0%   -3.18%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:32-8    198ns ± 0%   197ns ± 0%   -0.51%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:64-8    309ns ± 0%   313ns ± 0%   +1.30%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:1-8    652ns ± 0%   653ns ± 0%   +0.21%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:2-8    656ns ± 0%   656ns ± 0%     ~     (all equal)
LastIndexAnyASCII/256:4-8    663ns ± 0%   663ns ± 0%     ~     (p=0.444 n=5+5)
LastIndexAnyASCII/256:8-8    691ns ± 0%   690ns ± 0%     ~     (p=0.079 n=4+5)
LastIndexAnyASCII/256:16-8   719ns ± 0%   715ns ± 0%   -0.53%  (p=0.000 n=5+4)
LastIndexAnyASCII/256:32-8   779ns ± 0%   780ns ± 0%   +0.13%  (p=0.029 n=4+4)
LastIndexAnyASCII/256:64-8   890ns ± 0%   894ns ± 0%   +0.45%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:1-8      31.6ns ± 0%  33.5ns ± 0%   +6.01%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:2-8      48.6ns ± 0%  33.5ns ± 0%  -30.99%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:4-8      48.6ns ± 0%  33.5ns ± 0%  -31.13%  (p=0.000 n=5+4)
LastIndexAnyUTF8/1:8-8      89.6ns ± 0%  33.5ns ± 0%  -62.56%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:16-8      113ns ± 1%    36ns ± 0%  -68.47%  (p=0.000 n=5+4)
LastIndexAnyUTF8/1:32-8      190ns ± 0%    36ns ± 0%  -81.26%  (p=0.029 n=4+4)
LastIndexAnyUTF8/1:64-8      327ns ± 0%    40ns ± 0%  -87.77%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:1-8      364ns ± 0%   158ns ± 0%     ~     (p=0.079 n=4+5)
LastIndexAnyUTF8/16:2-8      636ns ± 0%   472ns ± 0%  -25.79%  (p=0.000 n=5+4)
LastIndexAnyUTF8/16:4-8      630ns ± 0%   472ns ± 0%  -25.03%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:8-8     1.28µs ± 0%  0.47µs ± 0%  -63.09%  (p=0.016 n=5+4)
LastIndexAnyUTF8/16:16-8    1.66µs ± 0%  0.53µs ± 0%  -68.39%  (p=0.016 n=5+4)
LastIndexAnyUTF8/16:32-8    2.88µs ± 0%  0.53µs ± 0%  -81.72%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:64-8    5.08µs ± 0%  0.57µs ± 0%  -88.79%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:1-8    5.41µs ± 0%  2.03µs ± 0%  -62.46%  (p=0.016 n=4+5)
LastIndexAnyUTF8/256:2-8    9.77µs ± 0%  7.14µs ± 0%  -26.97%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:4-8    9.63µs ± 0%  7.14µs ± 0%  -25.86%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:8-8    20.0µs ± 0%   7.1µs ± 0%  -64.30%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:16-8   26.1µs ± 1%   8.0µs ± 0%  -69.40%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:32-8   45.6µs ± 1%   8.0µs ± 0%  -82.51%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:64-8   80.8µs ± 0%   8.6µs ± 0%  -89.33%  (p=0.016 n=5+4)
pkg:bytes goos:linux goarch:arm64
IndexAnyASCII/1:1-8         26.2ns ± 1%  26.5ns ± 0%   +1.30%  (p=0.016 n=5+4)
IndexAnyASCII/1:2-8         18.5ns ± 0%  26.5ns ± 0%  +43.24%  (p=0.008 n=5+5)
IndexAnyASCII/1:4-8         21.0ns ± 0%  26.5ns ± 0%  +26.38%  (p=0.008 n=5+5)
IndexAnyASCII/1:8-8         37.5ns ± 0%  26.5ns ± 0%  -29.33%  (p=0.000 n=5+4)
IndexAnyASCII/1:16-8        49.6ns ± 0%  26.5ns ± 0%  -46.49%  (p=0.008 n=5+5)
IndexAnyASCII/1:32-8        73.6ns ± 0%  30.1ns ± 0%  -59.16%  (p=0.008 n=5+5)
IndexAnyASCII/1:64-8         122ns ± 0%    33ns ± 0%  -73.23%  (p=0.008 n=5+5)
IndexAnyASCII/16:1-8        73.7ns ± 0%  33.4ns ± 0%  -54.71%  (p=0.008 n=5+5)
IndexAnyASCII/16:2-8        79.1ns ± 0%  78.9ns ± 0%   -0.30%  (p=0.016 n=4+5)
IndexAnyASCII/16:4-8        84.8ns ± 0%  86.1ns ± 0%   +1.58%  (p=0.016 n=5+4)
IndexAnyASCII/16:8-8         111ns ± 0%   111ns ± 0%     ~     (all equal)
IndexAnyASCII/16:16-8        139ns ± 0%   144ns ± 0%   +3.60%  (p=0.016 n=4+5)
IndexAnyASCII/16:32-8        196ns ± 0%   207ns ± 0%   +5.61%  (p=0.016 n=5+4)
IndexAnyASCII/16:64-8        311ns ± 0%   320ns ± 0%   +2.89%  (p=0.016 n=4+5)
IndexAnyASCII/256:1-8        674ns ± 0%    65ns ± 1%  -90.35%  (p=0.008 n=5+5)
IndexAnyASCII/256:2-8        680ns ± 0%   680ns ± 0%     ~     (p=0.444 n=5+5)
IndexAnyASCII/256:4-8        686ns ± 0%   687ns ± 0%     ~     (p=0.167 n=5+5)
IndexAnyASCII/256:8-8        713ns ± 0%   712ns ± 0%   -0.14%  (p=0.008 n=5+5)
IndexAnyASCII/256:16-8       740ns ± 0%   744ns ± 0%   +0.54%  (p=0.016 n=5+4)
IndexAnyASCII/256:32-8       797ns ± 0%   808ns ± 0%   +1.43%  (p=0.008 n=5+5)
IndexAnyASCII/256:64-8       912ns ± 0%   921ns ± 0%   +0.99%  (p=0.016 n=4+5)
IndexAnyUTF8/1:1-8          27.5ns ± 0%  26.5ns ± 0%   -3.64%  (p=0.008 n=5+5)
IndexAnyUTF8/1:2-8          44.5ns ± 0%  26.5ns ± 0%  -40.50%  (p=0.008 n=5+5)
IndexAnyUTF8/1:4-8          45.6ns ± 0%  26.5ns ± 0%  -41.89%  (p=0.000 n=5+4)
IndexAnyUTF8/1:8-8          85.8ns ± 1%  26.5ns ± 0%  -69.11%  (p=0.008 n=5+5)
IndexAnyUTF8/1:16-8          110ns ± 1%    26ns ± 0%  -76.00%  (p=0.016 n=5+4)
IndexAnyUTF8/1:32-8          188ns ± 0%    30ns ± 0%  -84.04%  (p=0.008 n=5+5)
IndexAnyUTF8/1:64-8          333ns ± 0%    33ns ± 0%  -90.20%  (p=0.008 n=5+5)
IndexAnyUTF8/16:1-8          294ns ± 0%   235ns ± 0%  -20.07%  (p=0.008 n=5+5)
IndexAnyUTF8/16:2-8          563ns ± 0%   309ns ± 0%  -45.12%  (p=0.008 n=5+5)
IndexAnyUTF8/16:4-8          558ns ± 1%   309ns ± 0%  -44.60%  (p=0.000 n=5+4)
IndexAnyUTF8/16:8-8         1.23µs ± 0%  0.31µs ± 0%  -74.79%  (p=0.008 n=5+5)
IndexAnyUTF8/16:16-8        1.62µs ± 2%  0.31µs ± 0%  -80.93%  (p=0.008 n=5+5)
IndexAnyUTF8/16:32-8        2.86µs ± 0%  0.38µs ± 0%  -86.87%  (p=0.008 n=5+5)
IndexAnyUTF8/16:64-8        5.18µs ± 0%  0.42µs ± 0%  -91.86%  (p=0.008 n=5+5)
IndexAnyUTF8/256:1-8        4.27µs ± 1%  3.30µs ± 1%  -22.75%  (p=0.008 n=5+5)
IndexAnyUTF8/256:2-8        8.61µs ± 0%  4.45µs ± 0%  -48.31%  (p=0.016 n=4+5)
IndexAnyUTF8/256:4-8        8.44µs ± 0%  4.45µs ± 0%  -47.23%  (p=0.008 n=5+5)
IndexAnyUTF8/256:8-8        19.2µs ± 0%   4.5µs ± 0%  -76.78%  (p=0.008 n=5+5)
IndexAnyUTF8/256:16-8       25.6µs ± 0%   4.5µs ± 0%  -82.63%  (p=0.008 n=5+5)
IndexAnyUTF8/256:32-8       45.4µs ± 0%   5.5µs ± 0%  -87.85%  (p=0.016 n=4+5)
IndexAnyUTF8/256:64-8       82.5µs ± 0%   6.2µs ± 0%  -92.49%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:1-8     23.0ns ± 0%  26.5ns ± 0%  +15.02%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:2-8     24.5ns ± 0%  26.5ns ± 0%   +8.16%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:4-8     27.8ns ± 0%  26.5ns ± 0%   -4.68%  (p=0.029 n=4+4)
LastIndexAnyASCII/1:8-8     45.1ns ± 1%  26.5ns ± 0%  -41.29%  (p=0.000 n=5+4)
LastIndexAnyASCII/1:16-8    57.1ns ± 0%  26.5ns ± 0%  -53.61%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:32-8    81.5ns ± 0%  30.0ns ± 0%     ~     (p=0.079 n=4+5)
LastIndexAnyASCII/1:64-8     129ns ± 0%    32ns ± 0%  -74.81%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:1-8    72.6ns ± 0%  72.1ns ± 0%   -0.63%  (p=0.000 n=4+5)
LastIndexAnyASCII/16:2-8    77.2ns ± 0%  77.2ns ± 0%     ~     (p=0.167 n=5+5)
LastIndexAnyASCII/16:4-8    83.1ns ± 0%  83.2ns ± 0%     ~     (p=0.444 n=5+5)
LastIndexAnyASCII/16:8-8     109ns ± 1%   108ns ± 0%     ~     (p=0.167 n=5+5)
LastIndexAnyASCII/16:16-8    136ns ± 0%   136ns ± 0%     ~     (all equal)
LastIndexAnyASCII/16:32-8    195ns ± 0%   197ns ± 0%   +0.82%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:64-8    309ns ± 0%   309ns ± 0%     ~     (all equal)
LastIndexAnyASCII/256:1-8    653ns ± 0%   657ns ± 0%   +0.61%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:2-8    659ns ± 0%   658ns ± 0%     ~     (p=0.167 n=5+5)
LastIndexAnyASCII/256:4-8    664ns ± 0%   663ns ± 0%     ~     (p=0.095 n=5+4)
LastIndexAnyASCII/256:8-8    698ns ± 0%   689ns ± 0%   -1.29%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:16-8   726ns ± 0%   717ns ± 0%   -1.24%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:32-8   777ns ± 0%   779ns ± 0%     ~     (p=0.079 n=5+4)
LastIndexAnyASCII/256:64-8   889ns ± 0%   890ns ± 0%     ~     (p=0.444 n=5+5)
LastIndexAnyUTF8/1:1-8      32.1ns ± 0%  26.5ns ± 0%  -17.45%  (p=0.000 n=5+4)
LastIndexAnyUTF8/1:2-8      48.6ns ± 0%  26.5ns ± 0%  -45.52%  (p=0.000 n=5+4)
LastIndexAnyUTF8/1:4-8      49.6ns ± 0%  26.5ns ± 0%  -46.62%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:8-8      91.9ns ± 0%  26.5ns ± 0%  -71.18%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:16-8      114ns ± 1%    26ns ± 0%  -76.84%  (p=0.000 n=5+4)
LastIndexAnyUTF8/1:32-8      203ns ± 6%    30ns ± 0%  -85.25%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:64-8      330ns ± 0%    33ns ± 0%  -90.14%  (p=0.000 n=4+5)
LastIndexAnyUTF8/16:1-8      365ns ± 0%   164ns ± 0%  -55.04%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:2-8      638ns ± 0%   296ns ± 0%  -53.58%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:4-8      634ns ± 0%   296ns ± 0%  -53.31%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:8-8     1.30µs ± 0%  0.30µs ± 0%  -77.18%  (p=0.000 n=4+5)
LastIndexAnyUTF8/16:16-8    1.66µs ± 0%  0.30µs ± 0%  -82.19%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:32-8    2.90µs ± 0%  0.38µs ± 0%  -87.00%  (p=0.029 n=4+4)
LastIndexAnyUTF8/16:64-8    5.10µs ± 0%  0.42µs ± 0%  -91.78%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:1-8    5.42µs ± 0%  2.12µs ± 0%  -60.92%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:2-8    9.79µs ± 0%  4.26µs ± 0%  -56.47%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:4-8    9.66µs ± 0%  4.26µs ± 0%  -55.87%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:8-8    20.4µs ± 0%   4.3µs ± 0%  -79.10%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:16-8   26.0µs ± 1%   4.3µs ± 0%  -83.62%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:32-8   46.0µs ± 0%   5.5µs ± 0%  -88.09%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:64-8   81.1µs ± 0%   6.2µs ± 0%  -92.38%  (p=0.008 n=5+5)

name                         old time/op  new time/op   delta
pkg:strings goos:linux goarch:amd64
IndexAnyASCII/1:1-48         10.0ns ± 0%   13.3ns ± 0%  +33.00%  (p=0.008 n=5+5)
IndexAnyASCII/1:2-48         11.0ns ± 0%   15.5ns ± 0%  +40.55%  (p=0.016 n=4+5)
IndexAnyASCII/1:4-48         12.9ns ± 0%   15.4ns ± 0%  +19.69%  (p=0.008 n=5+5)
IndexAnyASCII/1:8-48         18.6ns ± 0%   15.5ns ± 0%  -16.45%  (p=0.000 n=4+5)
IndexAnyASCII/1:16-48        30.1ns ± 0%   16.9ns ± 0%     ~     (p=0.079 n=4+5)
IndexAnyASCII/1:32-48        53.1ns ± 0%   18.6ns ± 0%  -64.95%  (p=0.000 n=5+4)
IndexAnyASCII/1:64-48        98.9ns ± 0%   17.4ns ± 0%  -82.41%  (p=0.000 n=5+4)
IndexAnyASCII/16:1-48        35.0ns ± 0%   14.2ns ± 0%  -59.47%  (p=0.000 n=5+4)
IndexAnyASCII/16:2-48        35.5ns ± 0%   35.6ns ± 0%     ~     (p=0.238 n=5+4)
IndexAnyASCII/16:4-48        40.8ns ± 0%   40.7ns ± 1%     ~     (p=0.643 n=5+5)
IndexAnyASCII/16:8-48        50.8ns ± 0%   50.9ns ± 1%     ~     (p=1.000 n=4+5)
IndexAnyASCII/16:16-48       64.0ns ± 1%   64.5ns ± 1%     ~     (p=0.071 n=5+5)
IndexAnyASCII/16:32-48       98.3ns ± 0%  100.8ns ± 1%   +2.52%  (p=0.008 n=5+5)
IndexAnyASCII/16:64-48        156ns ± 0%    157ns ± 0%     ~     (p=0.238 n=4+5)
IndexAnyASCII/256:1-48        299ns ± 0%     24ns ± 3%  -92.12%  (p=0.008 n=5+5)
IndexAnyASCII/256:2-48        303ns ± 0%    304ns ± 0%     ~     (p=0.762 n=5+5)
IndexAnyASCII/256:4-48        311ns ± 0%    311ns ± 0%     ~     (p=0.476 n=5+5)
IndexAnyASCII/256:8-48        321ns ± 0%    321ns ± 0%     ~     (p=0.429 n=4+5)
IndexAnyASCII/256:16-48       334ns ± 0%    335ns ± 0%     ~     (p=0.079 n=5+4)
IndexAnyASCII/256:32-48       367ns ± 0%    365ns ± 0%     ~     (p=0.079 n=4+5)
IndexAnyASCII/256:64-48       431ns ± 1%    421ns ± 0%   -2.27%  (p=0.008 n=5+5)
IndexAnyUTF8/1:1-48          17.2ns ± 0%   10.8ns ± 0%  -37.21%  (p=0.029 n=4+4)
IndexAnyUTF8/1:2-48          26.7ns ± 0%   15.6ns ± 0%     ~     (p=0.079 n=4+5)
IndexAnyUTF8/1:4-48          28.2ns ± 0%   15.6ns ± 0%  -44.68%  (p=0.000 n=5+4)
IndexAnyUTF8/1:8-48          48.8ns ± 0%   15.6ns ± 0%  -68.03%  (p=0.029 n=4+4)
IndexAnyUTF8/1:16-48         58.3ns ± 0%   16.2ns ± 0%     ~     (p=0.079 n=4+5)
IndexAnyUTF8/1:32-48          103ns ± 0%     18ns ± 0%  -82.27%  (p=0.008 n=5+5)
IndexAnyUTF8/1:64-48          182ns ± 0%     17ns ± 0%  -90.53%  (p=0.008 n=5+5)
IndexAnyUTF8/16:1-48          197ns ± 0%     25ns ± 0%  -87.34%  (p=0.000 n=5+4)
IndexAnyUTF8/16:2-48          348ns ± 0%    163ns ± 0%  -53.11%  (p=0.000 n=5+4)
IndexAnyUTF8/16:4-48          374ns ± 0%    163ns ± 0%  -56.37%  (p=0.000 n=5+4)
IndexAnyUTF8/16:8-48          716ns ± 0%    163ns ± 0%  -77.22%  (p=0.000 n=5+4)
IndexAnyUTF8/16:16-48         859ns ± 0%    175ns ± 0%  -79.63%  (p=0.000 n=5+4)
IndexAnyUTF8/16:32-48        1.58µs ± 0%   0.20µs ± 0%  -87.01%  (p=0.029 n=4+4)
IndexAnyUTF8/16:64-48        2.84µs ± 0%   0.19µs ± 1%  -93.34%  (p=0.008 n=5+5)
IndexAnyUTF8/256:1-48        2.61µs ± 0%   0.27µs ± 0%  -89.81%  (p=0.008 n=5+5)
IndexAnyUTF8/256:2-48        4.95µs ± 0%   2.23µs ± 0%  -54.91%  (p=0.016 n=5+4)
IndexAnyUTF8/256:4-48        5.55µs ± 0%   2.23µs ± 0%  -59.72%  (p=0.008 n=5+5)
IndexAnyUTF8/256:8-48        10.8µs ± 0%    2.2µs ± 0%  -79.39%  (p=0.008 n=5+5)
IndexAnyUTF8/256:16-48       13.1µs ± 0%    2.5µs ± 0%  -81.21%  (p=0.016 n=4+5)
IndexAnyUTF8/256:32-48       24.7µs ± 0%    2.8µs ± 0%  -88.49%  (p=0.008 n=5+5)
IndexAnyUTF8/256:64-48       45.0µs ± 0%    2.6µs ± 1%  -94.23%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:1-48     13.9ns ± 0%   15.2ns ± 0%   +9.35%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:2-48     14.4ns ± 0%   15.2ns ± 0%   +5.56%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:4-48     16.7ns ± 0%   15.2ns ± 0%   -8.98%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:8-48     24.0ns ± 0%   15.2ns ± 0%  -36.67%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:16-48    35.6ns ± 0%   15.0ns ± 0%  -57.82%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:32-48    68.9ns ± 0%   16.7ns ± 0%  -75.75%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:64-48     104ns ± 0%     17ns ± 1%  -83.81%  (p=0.008 n=5+5)
LastIndexAnyASCII/16:1-48    35.0ns ± 0%   35.0ns ± 0%     ~     (all equal)
LastIndexAnyASCII/16:2-48    35.6ns ± 0%   35.6ns ± 0%     ~     (all equal)
LastIndexAnyASCII/16:4-48    41.0ns ± 0%   40.8ns ± 0%   -0.49%  (p=0.032 n=5+5)
LastIndexAnyASCII/16:8-48    50.9ns ± 0%   50.7ns ± 1%     ~     (p=0.397 n=5+5)
LastIndexAnyASCII/16:16-48   64.3ns ± 1%   64.4ns ± 1%     ~     (p=1.000 n=4+5)
LastIndexAnyASCII/16:32-48    100ns ± 0%    100ns ± 0%   +0.38%  (p=0.016 n=4+5)
LastIndexAnyASCII/16:64-48    157ns ± 1%    163ns ± 0%   +3.82%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:1-48    302ns ± 0%    300ns ± 0%   -0.53%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:2-48    305ns ± 0%    303ns ± 0%   -0.66%  (p=0.000 n=5+4)
LastIndexAnyASCII/256:4-48    313ns ± 0%    307ns ± 0%   -2.04%  (p=0.000 n=4+5)
LastIndexAnyASCII/256:8-48    323ns ± 0%    315ns ± 0%   -2.48%  (p=0.029 n=4+4)
LastIndexAnyASCII/256:16-48   333ns ± 0%    332ns ± 0%   -0.30%  (p=0.048 n=5+5)
LastIndexAnyASCII/256:32-48   366ns ± 0%    367ns ± 0%     ~     (p=0.238 n=4+5)
LastIndexAnyASCII/256:64-48   430ns ± 0%    430ns ± 0%     ~     (p=1.000 n=5+5)
LastIndexAnyUTF8/1:1-48      21.1ns ± 0%   13.9ns ± 0%  -34.00%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:2-48      29.5ns ± 0%   13.9ns ± 0%  -52.95%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:4-48      31.6ns ± 0%   13.9ns ± 0%  -55.96%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:8-48      51.1ns ± 0%   13.9ns ± 0%  -72.81%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:16-48     58.9ns ± 0%   14.6ns ± 0%  -75.23%  (p=0.016 n=5+4)
LastIndexAnyUTF8/1:32-48      103ns ± 0%     16ns ± 1%  -84.12%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:64-48      177ns ± 0%     17ns ± 1%  -90.62%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:1-48      275ns ± 1%    105ns ± 0%  -61.85%  (p=0.000 n=5+4)
LastIndexAnyUTF8/16:2-48      406ns ± 0%    216ns ± 0%  -46.70%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:4-48      458ns ± 0%    216ns ± 0%  -52.75%  (p=0.000 n=4+5)
LastIndexAnyUTF8/16:8-48      753ns ± 0%    216ns ± 0%  -71.31%  (p=0.029 n=4+4)
LastIndexAnyUTF8/16:16-48     902ns ± 0%    221ns ± 0%  -75.50%  (p=0.016 n=5+4)
LastIndexAnyUTF8/16:32-48    1.57µs ± 0%   0.24µs ± 0%  -84.46%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:64-48    2.77µs ± 0%   0.24µs ± 0%  -91.22%  (p=0.000 n=5+4)
LastIndexAnyUTF8/256:1-48    4.06µs ± 0%   1.53µs ± 0%  -62.26%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:2-48    5.92µs ± 0%   3.04µs ± 0%  -48.55%  (p=0.016 n=4+5)
LastIndexAnyUTF8/256:4-48    6.82µs ± 0%   3.04µs ± 0%  -55.34%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:8-48    11.5µs ± 0%    3.0µs ± 0%  -73.48%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:16-48   14.1µs ± 0%    3.1µs ± 0%  -77.85%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:32-48   24.5µs ± 0%    3.5µs ± 0%  -85.85%  (p=0.016 n=5+4)
LastIndexAnyUTF8/256:64-48   44.0µs ± 0%    3.5µs ± 0%  -92.12%  (p=0.008 n=5+5)
pkg:bytes goos:linux goarch:amd64
IndexAnyASCII/1:1-48         9.56ns ± 0%  11.00ns ± 0%  +15.06%  (p=0.016 n=5+4)
IndexAnyASCII/1:2-48         11.0ns ± 0%   10.8ns ± 2%   -1.64%  (p=0.048 n=5+5)
IndexAnyASCII/1:4-48         13.9ns ± 0%   11.0ns ± 1%  -21.15%  (p=0.008 n=5+5)
IndexAnyASCII/1:8-48         19.6ns ± 0%   10.8ns ± 3%  -44.90%  (p=0.008 n=5+5)
IndexAnyASCII/1:16-48        31.1ns ± 0%   11.5ns ± 0%  -63.02%  (p=0.008 n=5+5)
IndexAnyASCII/1:32-48        54.0ns ± 0%   11.8ns ± 0%  -78.15%  (p=0.000 n=5+4)
IndexAnyASCII/1:64-48         100ns ± 0%     13ns ± 0%  -86.89%  (p=0.008 n=5+5)
IndexAnyASCII/16:1-48        35.5ns ± 0%   14.8ns ± 0%  -58.26%  (p=0.008 n=5+5)
IndexAnyASCII/16:2-48        36.2ns ± 1%   36.0ns ± 1%     ~     (p=0.087 n=5+5)
IndexAnyASCII/16:4-48        40.3ns ± 1%   39.7ns ± 4%     ~     (p=0.175 n=4+5)
IndexAnyASCII/16:8-48        48.7ns ± 5%   45.8ns ± 0%   -6.02%  (p=0.016 n=5+4)
IndexAnyASCII/16:16-48       64.1ns ±11%   62.1ns ± 1%     ~     (p=0.143 n=5+5)
IndexAnyASCII/16:32-48       97.9ns ± 1%   98.3ns ± 1%     ~     (p=0.294 n=5+5)
IndexAnyASCII/16:64-48        163ns ± 0%    157ns ± 0%   -3.68%  (p=0.008 n=5+5)
IndexAnyASCII/256:1-48        389ns ± 0%     25ns ± 0%  -93.65%  (p=0.000 n=5+4)
IndexAnyASCII/256:2-48        391ns ± 0%    307ns ± 0%  -21.48%  (p=0.000 n=5+4)
IndexAnyASCII/256:4-48        394ns ± 0%    323ns ± 0%  -17.92%  (p=0.008 n=5+5)
IndexAnyASCII/256:8-48        402ns ± 0%    323ns ± 0%  -19.51%  (p=0.008 n=5+5)
IndexAnyASCII/256:16-48       414ns ± 0%    334ns ± 0%  -19.32%  (p=0.016 n=4+5)
IndexAnyASCII/256:32-48       446ns ± 0%    367ns ± 0%  -17.75%  (p=0.016 n=5+4)
IndexAnyASCII/256:64-48       511ns ± 0%    424ns ± 0%  -17.02%  (p=0.008 n=5+5)
IndexAnyUTF8/1:1-48          17.4ns ± 0%   11.0ns ± 0%  -36.64%  (p=0.008 n=5+5)
IndexAnyUTF8/1:2-48          27.3ns ± 1%   11.0ns ± 0%  -59.74%  (p=0.008 n=5+5)
IndexAnyUTF8/1:4-48          28.7ns ± 0%   11.0ns ± 0%  -61.73%  (p=0.008 n=5+5)
IndexAnyUTF8/1:8-48          49.2ns ± 0%   11.0ns ± 0%  -77.66%  (p=0.008 n=5+5)
IndexAnyUTF8/1:16-48         56.0ns ± 0%   11.5ns ± 0%  -79.46%  (p=0.000 n=5+4)
IndexAnyUTF8/1:32-48          102ns ± 0%     12ns ± 0%  -88.24%  (p=0.008 n=5+5)
IndexAnyUTF8/1:64-48          177ns ± 0%     13ns ± 0%  -92.51%  (p=0.008 n=5+5)
IndexAnyUTF8/16:1-48          212ns ± 0%    112ns ± 0%  -47.17%  (p=0.008 n=5+5)
IndexAnyUTF8/16:2-48          356ns ± 0%    159ns ± 1%  -55.28%  (p=0.000 n=4+5)
IndexAnyUTF8/16:4-48          372ns ± 0%    158ns ± 0%  -57.47%  (p=0.008 n=5+5)
IndexAnyUTF8/16:8-48          712ns ± 0%    159ns ± 1%  -77.70%  (p=0.008 n=5+5)
IndexAnyUTF8/16:16-48         829ns ± 0%    129ns ± 0%  -84.44%  (p=0.008 n=5+5)
IndexAnyUTF8/16:32-48        1.55µs ± 0%   0.16µs ± 0%  -89.87%  (p=0.008 n=5+5)
IndexAnyUTF8/16:64-48        2.77µs ± 0%   0.14µs ± 0%  -94.94%  (p=0.008 n=5+5)
IndexAnyUTF8/256:1-48        2.85µs ± 0%   1.63µs ± 1%  -42.74%  (p=0.008 n=5+5)
IndexAnyUTF8/256:2-48        5.14µs ± 1%   2.03µs ± 0%  -60.51%  (p=0.008 n=5+5)
IndexAnyUTF8/256:4-48        5.56µs ± 0%   2.03µs ± 0%  -63.52%  (p=0.008 n=5+5)
IndexAnyUTF8/256:8-48        10.8µs ± 0%    2.0µs ± 0%  -81.22%  (p=0.008 n=5+5)
IndexAnyUTF8/256:16-48       12.9µs ± 0%    1.9µs ± 0%  -85.55%  (p=0.008 n=5+5)
IndexAnyUTF8/256:32-48       24.2µs ± 0%    2.1µs ± 0%  -91.29%  (p=0.016 n=5+4)
IndexAnyUTF8/256:64-48       43.7µs ± 0%    2.0µs ± 0%  -95.32%  (p=0.016 n=5+4)
LastIndexAnyASCII/1:1-48     13.7ns ± 1%   12.8ns ± 0%   -6.57%  (p=0.016 n=5+4)
LastIndexAnyASCII/1:2-48     14.7ns ± 0%   12.7ns ± 1%  -13.33%  (p=0.000 n=4+5)
LastIndexAnyASCII/1:4-48     16.9ns ± 0%   12.7ns ± 1%  -24.73%  (p=0.000 n=4+5)
LastIndexAnyASCII/1:8-48     20.5ns ± 0%   12.7ns ± 0%  -37.85%  (p=0.000 n=4+5)
LastIndexAnyASCII/1:16-48    28.0ns ± 0%   11.7ns ± 0%     ~     (p=0.079 n=4+5)
LastIndexAnyASCII/1:32-48    69.8ns ± 0%   12.4ns ± 0%  -82.19%  (p=0.008 n=5+5)
LastIndexAnyASCII/1:64-48    73.8ns ± 0%   13.3ns ± 0%  -82.03%  (p=0.000 n=4+5)
LastIndexAnyASCII/16:1-48    35.5ns ± 0%   35.5ns ± 0%     ~     (all equal)
LastIndexAnyASCII/16:2-48    36.0ns ± 0%   36.1ns ± 0%   +0.28%  (p=0.016 n=4+5)
LastIndexAnyASCII/16:4-48    40.3ns ± 2%   40.0ns ± 6%     ~     (p=0.651 n=5+5)
LastIndexAnyASCII/16:8-48    50.3ns ± 0%   50.2ns ± 9%     ~     (p=0.175 n=4+5)
LastIndexAnyASCII/16:16-48   62.4ns ± 4%   64.4ns ± 0%   +3.28%  (p=0.016 n=5+4)
LastIndexAnyASCII/16:32-48   98.9ns ± 0%   98.4ns ± 0%   -0.53%  (p=0.016 n=5+4)
LastIndexAnyASCII/16:64-48    160ns ± 1%    161ns ± 1%     ~     (p=0.325 n=5+5)
LastIndexAnyASCII/256:1-48    300ns ± 0%    301ns ± 0%   +0.33%  (p=0.008 n=5+5)
LastIndexAnyASCII/256:2-48    304ns ± 0%    304ns ± 0%     ~     (p=1.000 n=5+5)
LastIndexAnyASCII/256:4-48    311ns ± 0%    311ns ± 0%     ~     (p=0.556 n=4+5)
LastIndexAnyASCII/256:8-48    320ns ± 0%    321ns ± 0%     ~     (p=0.143 n=5+5)
LastIndexAnyASCII/256:16-48   333ns ± 0%    335ns ± 0%   +0.60%  (p=0.029 n=4+4)
LastIndexAnyASCII/256:32-48   367ns ± 0%    366ns ± 0%     ~     (p=0.095 n=4+5)
LastIndexAnyASCII/256:64-48   431ns ± 0%    424ns ± 0%   -1.62%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:1-48      19.7ns ± 1%   11.9ns ± 0%  -39.47%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:2-48      27.6ns ± 1%   11.9ns ± 0%  -56.82%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:4-48      29.9ns ± 0%   11.9ns ± 0%     ~     (p=0.079 n=4+5)
LastIndexAnyUTF8/1:8-48      48.7ns ± 0%   11.9ns ± 0%  -75.54%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:16-48     57.8ns ± 0%   11.4ns ± 0%  -80.26%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:32-48     94.7ns ± 0%   12.2ns ± 0%  -87.07%  (p=0.008 n=5+5)
LastIndexAnyUTF8/1:64-48      163ns ± 0%     13ns ± 1%  -91.93%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:1-48      258ns ± 0%     88ns ± 0%  -65.76%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:2-48      400ns ± 0%    162ns ± 0%  -59.38%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:4-48      415ns ± 0%    162ns ± 0%  -60.87%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:8-48      737ns ± 0%    162ns ± 0%  -78.02%  (p=0.000 n=5+4)
LastIndexAnyUTF8/16:16-48     882ns ± 0%    128ns ± 0%  -85.49%  (p=0.008 n=5+5)
LastIndexAnyUTF8/16:32-48    1.47µs ± 0%   0.16µs ± 0%  -89.29%  (p=0.000 n=4+5)
LastIndexAnyUTF8/16:64-48    2.56µs ± 0%   0.14µs ± 0%  -94.41%  (p=0.016 n=5+4)
LastIndexAnyUTF8/256:1-48    3.60µs ± 0%   1.23µs ± 0%  -65.67%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:2-48    5.78µs ± 0%   2.18µs ± 0%  -62.32%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:4-48    6.26µs ± 0%   2.18µs ± 0%  -65.15%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:8-48    11.2µs ± 0%    2.2µs ± 0%  -80.53%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:16-48   13.5µs ± 0%    1.9µs ± 0%  -86.02%  (p=0.016 n=4+5)
LastIndexAnyUTF8/256:32-48   23.0µs ± 0%    2.1µs ± 0%  -90.72%  (p=0.008 n=5+5)
LastIndexAnyUTF8/256:64-48   40.5µs ± 0%    2.1µs ± 0%  -94.73%  (p=0.008 n=5+5)

Change-Id: Ie05e306f8b184b989701868cb161ce8b3f18203b
Reviewed-on: https://go-review.googlesource.com/c/go/+/156998
Run-TryBot: eric fang <eric.fang@arm.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: fix problem with repeated panic/recover/re-panics and open-coded defers
Dan Scales [Thu, 5 Mar 2020 20:46:04 +0000 (12:46 -0800)]
runtime: fix problem with repeated panic/recover/re-panics and open-coded defers

In the open-code defer implementation, we add defer struct entries to the defer
chain on-the-fly at panic time to represent stack frames that contain open-coded
defers. This allows us to process non-open-coded and open-coded defers in the
correct order. Also, we need somewhere to be able to store the 'started' state of
open-coded defers. However, if a recover succeeds, defers will now be processed
inline again (unless another panic happens). Any defer entry representing a frame
with open-coded defers will become stale once we run the corresponding defers
inline and exit the associated stack frame. So, we need to remove all entries for
open-coded defers at recover time.

The current code was only removing the top-most open-coded defer from the defer
chain during recovery. However, with recursive functions that do repeated
panic-recover-repanic, multiple stale entries can accumulate on the chain. So, we
just adjust the loop to process the entire chain. Since this is at panic/recover
case, it is fine to scan through the entire chain (which should usually have few
elements in it, since most defers are open-coded).

The added test fails with a SEGV without the fix, because it tries to run a stale
open-code defer entry (and the stack has changed).

Fixes #37664.

Change-Id: I8e3da5d610b5e607411451b66881dea887f7484d
Reviewed-on: https://go-review.googlesource.com/c/go/+/222420
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/link: fix for package name attr testpoint in dwarf_test.go
Than McIntosh [Fri, 7 Feb 2020 19:00:26 +0000 (14:00 -0500)]
cmd/link: fix for package name attr testpoint in dwarf_test.go

Tighten up a testpoint that looks for the compile unit
DW_AT_go_package_name attribute. The linker code that injects this
attribute was accidentally broken on the dev.link branch, but in a way
that wasn't detected by the test (attr was generated, but always with
an empty string). The new test will fail if the attr is an empty
string, or if we can't find the attribute for the runtime package.

Change-Id: I8b065e7eb3486646364d0eaf48a73db6acffbd18
Reviewed-on: https://go-review.googlesource.com/c/go/+/218483
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/go/internal/lockedfile: use a retry loop to suppress EDEADLK on AIX and Solaris
Bryan C. Mills [Thu, 5 Mar 2020 21:17:45 +0000 (16:17 -0500)]
cmd/go/internal/lockedfile: use a retry loop to suppress EDEADLK on AIX and Solaris

AIX, Solaris, and Illumos all appear to implement fcntl deadlock
detection at the granularity of processes. However, we are acquiring
and releasing file locks on individual goroutines running
concurrently: our locking occurs at a much finer granularity. As a
result, these platforms occasionally fail with EDEADLK errors, when
they detect locks that would be _misordered_ in a single-threaded
program but are safely _unordered_ in a multi-threaded context.

To work around the spurious errors, we treat EDEADLK as always
spurious, and retry the failing system call with a bounded exponential
backoff. This approach may introduce substantial latency since we no
longer benefit from kernel-scheduled wakeups in case of collisions,
but high-latency operations seem better than spurious failures.

Updates #33974
Updates #35618
Fixes #32817

Change-Id: I58b2c6a0f143bce55d6460fd4ddc3db83577ada7
Reviewed-on: https://go-review.googlesource.com/c/go/+/222277
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agoruntime: make typehash match compiler generated hashes exactly
Keith Randall [Fri, 6 Mar 2020 22:01:26 +0000 (14:01 -0800)]
runtime: make typehash match compiler generated hashes exactly

If typehash (used by reflect) does not match the built-in map's hash,
then problems occur. If a map is built using reflect, and then
assigned to a variable of map type, the hash function can change. That
causes very bad things.

This issue is rare. MapOf consults a cache of all types that occur in
the binary before making a new one. To make a true new map type (with
a hash function derived from typehash) that map type must not occur in
the binary anywhere. But to cause the bug, we need a variable of that
type in order to assign to it. The only way to make that work is to
use a named map type for the variable, so it is distinct from the
unnamed version that MapOf looks for.

Fixes #37716

Change-Id: I3537bfceca8cbfa1af84202f432f3c06953fe0ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/222357
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: remove special handling for OpRISCV64SUBW in markUnsafePoints
Joel Sing [Mon, 9 Mar 2020 16:27:44 +0000 (03:27 +1100)]
cmd/compile: remove special handling for OpRISCV64SUBW in markUnsafePoints

Due to improved optimisation, we no longer emit SUBW for the write barrier
checks on riscv64, hence remove special handling in markUnsafePoints.

Change-Id: Ia1150c3e11f25e183735e58f8716a511d9e90fb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/222638
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agodebug/pe: copy some consts from cmd/link/internal/ld
Alex Brainman [Mon, 9 Mar 2020 06:49:13 +0000 (17:49 +1100)]
debug/pe: copy some consts from cmd/link/internal/ld

This CL copies IMAGE_FILE_*, IMAGE_SUBSYSTEM_* and
IMAGE_DLLCHARACTERISTICS_* consts from cmd/link/internal/ld package.

The consts are also used in cmd/go and debug/pe tests. So avoid the
duplication.

The consts are defined in

https://docs.microsoft.com/en-us/windows/win32/debug/pe-format

and might be useful to other Go users.

The CL also adds some related consts.

RELNOTE=yes

Change-Id: Iaa868deaffc7c61051f2273397f3e7e101880a5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/222637
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/cgo: always produce a parameter name for C code
Ian Lance Taylor [Tue, 10 Mar 2020 04:33:35 +0000 (21:33 -0700)]
cmd/cgo: always produce a parameter name for C code

Updates #37746

Change-Id: Ib64abe3995f310cd50ede47b0d3d159572901000
Reviewed-on: https://go-review.googlesource.com/c/go/+/222622
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/cgo: updated exported function parameter names
Nathan Fiscaletti [Tue, 10 Mar 2020 00:22:01 +0000 (00:22 +0000)]
cmd/cgo: updated exported function parameter names

Functions that are exported through cgo will now retain their
parameter names provided that their parameter names use only
ASCII characters.

Fixes #37746

Change-Id: Ia5f643e7d872312e81c224febd1f81ce14425c32
GitHub-Last-Rev: 220959bebae7d654d96530498f40e3a2abe95080
GitHub-Pull-Request: golang/go#37750
Reviewed-on: https://go-review.googlesource.com/c/go/+/222619
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/vet: add ifaceassert and stringintconv checks
smasher164 [Thu, 27 Feb 2020 08:44:13 +0000 (03:44 -0500)]
cmd/vet: add ifaceassert and stringintconv checks

This change re-vendors x/tools to add the ifaceassert and stringintconv
checks to cmd/vet.

Fixes #32479.
Updates #4483.

Change-Id: I6bd30b0a3278592dfab4bd247036404ddaff09e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/221339
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: avoid string(int) conversion
smasher164 [Thu, 27 Feb 2020 08:14:21 +0000 (03:14 -0500)]
cmd/compile: avoid string(int) conversion

Rewrite string(int) to a string literal with a NUL byte, in preparation for the vet warning.

Updates #32479.

Change-Id: If4b6879334884324df3d566b6b4166ecf501d066
Reviewed-on: https://go-review.googlesource.com/c/go/+/221338
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/compile: insert complicated x86 addressing modes as a separate pass
Keith Randall [Thu, 30 Jan 2020 18:17:01 +0000 (10:17 -0800)]
cmd/compile: insert complicated x86 addressing modes as a separate pass

Use a separate compiler pass to introduce complicated x86 addressing
modes.  Loads in the normal architecture rules (for x86 and all other
platforms) can have constant offsets (AuxInt values) and symbols (Aux
values), but no more.

The complex addressing modes (x+y, x+2*y, etc.) are introduced in a
separate pass that combines loads with LEAQx ops.

Organizing rewrites this way simplifies the number of rewrites
required, as there are lots of different rule orderings that have to
be specified to ensure these complex addressing modes are always found
if they are possible.

Update #36468

Change-Id: I5b4bf7b03a1e731d6dfeb9ef19b376175f3b4b44
Reviewed-on: https://go-review.googlesource.com/c/go/+/217097
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
5 years agostd,cmd: update x/net and github.com/google/pprof
smasher164 [Thu, 27 Feb 2020 07:42:28 +0000 (02:42 -0500)]
std,cmd: update x/net and github.com/google/pprof

Re-vendor x/net/dns/dnsmessage, x/net/route, and github.com/google/pprof
(commit 1ebb73c). The updated dependencies fix the string(int)
conversions, in preparation for the vet warning.

Updates #32479.

Change-Id: I023a4e30415d060f8b403b9943fe911f6d19f2e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/221337
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: use only bit patterns in isNonNegative
Josh Bleecher Snyder [Mon, 9 Mar 2020 13:37:49 +0000 (06:37 -0700)]
cmd/compile: use only bit patterns in isNonNegative

CL 212777 added a check to isNonNegative
to return true for unsigned values.
However, the SSA backend isn't type safe
enough for that to be sound.
The other checks in isNonNegative
look only at the pattern of bits.
Remove the type-based check.

Updates #37753

Change-Id: I059d0e86353453133f2a160dce53af299f42e533
Reviewed-on: https://go-review.googlesource.com/c/go/+/222620
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: remove -largemodel flag from docs
Keith Randall [Mon, 9 Mar 2020 19:46:45 +0000 (12:46 -0700)]
cmd/compile: remove -largemodel flag from docs

It does nothing (it can't even be parsed).

Change-Id: I29abdddea1955d2ad93a97696f6542fa47cdb954
Reviewed-on: https://go-review.googlesource.com/c/go/+/222672
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go/internal/modload: factor smaller files out of load.go and init.go
Bryan C. Mills [Fri, 6 Mar 2020 22:18:16 +0000 (17:18 -0500)]
cmd/go/internal/modload: factor smaller files out of load.go and init.go

No semantic changes intended: just structural cleanup.

Updates #36460

Change-Id: I405bc2572d3ff00f595dae645e673a11e01621ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/222340
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agointernal/xcoff: fix wrong bit masking comparisons
Neven Sajko [Sat, 7 Mar 2020 17:23:20 +0000 (17:23 +0000)]
internal/xcoff: fix wrong bit masking comparisons

I do not know much about xcoff, but this was probably the intended
behavior. (The comparison is tautologically false, as is.)

Also note: does any other code even depend on the changed code existing?
Maybe it should just be removed, as I did not find any uses of fields
that are written to if the branch condition tests true.

Change-Id: I1f23d33764df40e87f3e64460d63f6efc51a2a78
GitHub-Last-Rev: 268909130fd7fb3993fcf7004143ec48dbfe5e2a
GitHub-Pull-Request: golang/go#37733
Reviewed-on: https://go-review.googlesource.com/c/go/+/222478
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Clément Chigot <clement.chigot%atos.net@gtempaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoerrors: fix typo in As documentation
Yann Salaün [Mon, 9 Mar 2020 16:57:08 +0000 (16:57 +0000)]
errors: fix typo in As documentation

Change-Id: Ia26b4457aa0780171a636df93f8d210de0278ec5
GitHub-Last-Rev: 577a6fec336010cb56a547bf2d6304fd3e0cb257
GitHub-Pull-Request: golang/go#37760
Reviewed-on: https://go-review.googlesource.com/c/go/+/222621
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotest/run: make GO_GCFLAGS mean same thing it does during make.bash
Russ Cox [Wed, 8 Jan 2020 16:00:44 +0000 (11:00 -0500)]
test/run: make GO_GCFLAGS mean same thing it does during make.bash

-gcflags=-flag means apply the flags only to the package named
on the command line (the main package, for these tests).

-gcflags=all=-flag means apply the flags to everything in the build,
including the standard library.

cmd/dist uses -gcflags=all=$GO_GCFLAGS, so test/run should do the same,
as the comment already explains, to avoid rebuilding the entire standard
library without the flags during test/run's builds.

We changed the scope of the flags without a pattern a few releases
ago and missed this one.

Change-Id: I039e60ca619d39e5b502261d4a73e1afc7e3f9fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/213827
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: make ssa.Edge a stringer
Josh Bleecher Snyder [Wed, 4 Mar 2020 15:24:56 +0000 (07:24 -0800)]
cmd/compile: make ssa.Edge a stringer

To aid in debugging.

Change-Id: I2330499b5f2ecbeb02f7e3bc0b17ded755d5c685
Reviewed-on: https://go-review.googlesource.com/c/go/+/222617
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/cgo: avoid extra newline in doc comment of exported function
Nathan Fiscaletti [Sat, 7 Mar 2020 05:44:31 +0000 (05:44 +0000)]
cmd/cgo: avoid extra newline in doc comment of exported function

Fixes #37722

Change-Id: Ie9154f9d91824558a8ac34ad2fb5bc4e02c64a4b
GitHub-Last-Rev: 9fbe1c1d802287ff3c3ccee62e4e74d802196ffb
GitHub-Pull-Request: golang/go#37723
Reviewed-on: https://go-review.googlesource.com/c/go/+/222419
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agomime: add .json to built-in list of MIME types
An Long [Fri, 6 Mar 2020 23:31:35 +0000 (23:31 +0000)]
mime: add .json to built-in list of MIME types

Since json is popular and mime package's builtin type does not contain
it, and some Linux distributions do not contain the '/etc/mime.types' file
with minimal installations.

Change-Id: I933393c82be296ef176206c253f4dd19b6f33bb1
GitHub-Last-Rev: ce4eae56a4d468631555dc85e0e7ab4bbd0ef45d
GitHub-Pull-Request: golang/go#34737
Reviewed-on: https://go-review.googlesource.com/c/go/+/199657
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agonet/http/cgi: remove outdated TODO
Tim Cooper [Thu, 27 Feb 2020 18:11:30 +0000 (12:11 -0600)]
net/http/cgi: remove outdated TODO

Cookies already work as http.Request parses the Cookie header on-demand
when the Cookie methods are called.

Change-Id: Ib7a6f68be02940ff0b56d2465c94545d6fd43847
Reviewed-on: https://go-review.googlesource.com/c/go/+/221417
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: avoid range over copy of array
Cuong Manh Le [Fri, 1 Nov 2019 11:12:27 +0000 (18:12 +0700)]
cmd/compile: avoid range over copy of array

Passes toostash-check.

Slightly reduce compiler binary size:

file    before    after     Δ       %
compile 21087288  21070776  -16512  -0.078%
total   131847020 131830508 -16512  -0.013%

file                      before    after     Δ       %
cmd/compile/internal/gc.a 9007472   8999640   -7832   -0.087%
total                     127117794 127109962 -7832   -0.006%

Change-Id: I4aadd68d0a7545770598bed9d3a4d05899b67b52
Reviewed-on: https://go-review.googlesource.com/c/go/+/205777
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/dist: forward stderr if 'go env CGO_ENABLED' fails
Bryan C. Mills [Fri, 6 Mar 2020 19:32:26 +0000 (14:32 -0500)]
cmd/dist: forward stderr if 'go env CGO_ENABLED' fails

The default error string for a command failure is just its status code,
and "exit status 1" is not at all helpful for debugging.

Change-Id: I822c89bcc9e73283b33e01792bf9c40b1add3c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/222308
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
5 years agocmd/go: make go test -json report failures for panicking/exiting tests
Jay Conrod [Thu, 5 Mar 2020 16:11:47 +0000 (11:11 -0500)]
cmd/go: make go test -json report failures for panicking/exiting tests

'go test -json' should report that a test failed if the test binary
did not exit normally with status 0. This covers panics, non-zero
exits, and abnormal terminations.

These tests don't print a final result when run with -test.v (which is
used by 'go test -json'). The final result should be "PASS" or "FAIL"
on a line by itself. 'go test' prints "FAIL" in this case, but
includes error information.

test2json was changed in CL 192104 to report that a test passed if it
does not report a final status. This caused 'go test -json' to report
that a test passed after a panic or non-zero exit.

With this change, test2json treats "FAIL" with error information the
same as "FAIL" on a line by itself. This is intended to be a minimal
fix for backporting, but it will likely be replaced by a complete
solution for #29062.

Fixes #37555
Updates #29062
Updates #31969

Change-Id: Icb67bcd36bed97e6a8d51f4d14bf71f73c83ac3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/222243
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.14: document that unparsable URL in net/url.Error is now quoted
Stefan Baebler [Fri, 6 Mar 2020 08:21:26 +0000 (08:21 +0000)]
doc/go1.14: document that unparsable URL in net/url.Error is now quoted

Fixes #37614
Updates #36878
Updates #29384
Updates #37630

Change-Id: I63dad8b554353197ae0f29fa2a84f17bffa58557
GitHub-Last-Rev: 5297df32200ea5b52b2e7b52c8ee022d37e44111
GitHub-Pull-Request: golang/go#37661
Reviewed-on: https://go-review.googlesource.com/c/go/+/222037
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime/pprof: expand final stack frame to avoid truncation
Michael Pratt [Fri, 28 Feb 2020 19:16:41 +0000 (14:16 -0500)]
runtime/pprof: expand final stack frame to avoid truncation

When generating stacks, the runtime automatically expands inline
functions to inline all inline frames in the stack. However, due to the
stack size limit, the final frame may be truncated in the middle of
several inline frames at the same location.

As-is, we assume that the final frame is a normal function, and emit and
cache a Location for it. If we later receive a complete stack frame, we
will first use the cached Location for the inlined function and then
generate a new Location for the "caller" frame, in violation of the
pprof requirement to merge inlined functions into the same Location.

As a result, we:

1. Nondeterministically may generate a profile with the different stacks
combined or split, depending on which is encountered first. This is
particularly problematic when performing a diff of profiles.

2. When split stacks are generated, we lose the inlining information.

We avoid both of these problems by performing a second expansion of the
last stack frame to recover additional inline frames that may have been
lost. This expansion is a bit simpler than the one done by the runtime
because we don't have to handle skipping, and we know that the last
emitted frame is not an elided wrapper, since it by definition is
already included in the stack.

Fixes #37446

Change-Id: If3ca2af25b21d252cf457cc867dd932f107d4c61
Reviewed-on: https://go-review.googlesource.com/c/go/+/221577
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
5 years agocmd/go/internal/renameio: skip test affected by kernel bug on macOS 10.14 builders
Bryan C. Mills [Thu, 5 Mar 2020 16:14:25 +0000 (11:14 -0500)]
cmd/go/internal/renameio: skip test affected by kernel bug on macOS 10.14 builders

The test will remain flaky on the -nocgo builder until #37695 is addressed.

Updates #37695
Fixes #33041

Change-Id: I5d661ef39e82ab1dce3a76e0e4059cf556135e89
Reviewed-on: https://go-review.googlesource.com/c/go/+/222158
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/compile/internal/scanner: report correct directive string (fix build)
Robert Griesemer [Thu, 5 Mar 2020 20:55:44 +0000 (12:55 -0800)]
cmd/compile/internal/scanner: report correct directive string (fix build)

Change-Id: I01b244e97e4140545a46b3d494489a30126c2139
Reviewed-on: https://go-review.googlesource.com/c/go/+/222257
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agoruntime: use staticuint64s instead of staticbytes for 1-length strings
Diogo Pinela [Thu, 5 Mar 2020 00:28:05 +0000 (00:28 +0000)]
runtime: use staticuint64s instead of staticbytes for 1-length strings

This was the last remaining use of staticbytes, so we can now
delete it.

The new code appears slightly faster on amd64:

name                   old time/op  new time/op  delta
SliceByteToString/1-4  6.29ns ± 2%  5.89ns ± 1%  -6.46%  (p=0.000 n=14+14)

This may not be the case on the big-endian architectures, since they have
to do an extra addition.

Updates #37612

Change-Id: Icb84c5911ba025f798de152849992a55be99e4f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/221979
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile/internal/syntax: faster and simpler source reader
Robert Griesemer [Thu, 27 Feb 2020 05:31:00 +0000 (21:31 -0800)]
cmd/compile/internal/syntax: faster and simpler source reader

This is one of several changes that were part of a larger rewrite
which I made in early 2019 after switching to the new number literal
syntax implementation. The purpose of the rewrite was to simplify
reading of source code (Unicode character by character) and speed up
the scanner but was never submitted for review due to other priorities.

Part 3 of 3:

This change contains a complete rewrite of source.go, the file that
implements reading individual Unicode characters from the source.
The new implementation is easier to use and has simpler literal
buffer management, resulting in faster scanner and thus parser
performance.

Thew new source.go (internal) API is centered around nextch() which
advances the scanner by one character. The scanner has been adjusted
around nextch() and now consistently does one character look-ahead
(there's no need for complicated ungetr-ing anymore). Only in one
case backtrack is needed (when finding '..' rather than '...') and
that case is now more cleanly solved with the new reset() function.

Measuring line/s parsing peformance by running

go test -run StdLib -fast -skip "syntax/(scanner|source)\.go"

(best of 5 runs on "quiet" MacBook Pro, 3.3GHz Dual-Core i7, 16GB RAM,
OS X 10.15.3) before and after shows consistently 3-5% improvement of
line parsing speed:

old: parsed 1788155 lines (3969 files) in 1.255520307s (1424234 lines/s)
new: parsed 1788155 lines (3969 files) in 1.213197037s (1473919 lines/s)

(scanner.go and parser.go are skipped because this CL changed those files.)

Change-Id: Ida947f4b538d42eb2d2349062c69edb6c9e5ca66
Reviewed-on: https://go-review.googlesource.com/c/go/+/221603
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile: add zero store operations for riscv64
Joel Sing [Sun, 1 Mar 2020 17:26:54 +0000 (04:26 +1100)]
cmd/compile: add zero store operations for riscv64

This allows for zero stores to be performed using the zero register, rather
than loading a separate register with zero.

Change-Id: Ic81d8dbcdacbb2ca2c3f77682ff5ad7cdc33d18d
Reviewed-on: https://go-review.googlesource.com/c/go/+/221684
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/doc: fix merging comments in -src mode
Ivan Trubach [Thu, 12 Dec 2019 13:33:42 +0000 (13:33 +0000)]
cmd/doc: fix merging comments in -src mode

These changes fix go doc -src mode that vomits comments from random files if
filesystem does not sort files by name. The issue was with parse.ParseDir
using the Readdir order of files, which varies between platforms and filesystem
implementations. Another option is to merge comments using token.FileSet.Iterate
order in cmd/doc, but since ParseDir is mostly used in go doc, I’ve opted for
smaller change because it’s unlikely to break other uses or cause any perfomance
issues.

Example (macOS APFS): `go doc -src net.ListenPacket`

Change-Id: I7f9f368c7d9ccd9a2cbc48665f2cb9798c7b3a3f
GitHub-Last-Rev: 654fb450421266a0bb64518016944db22bd681e3
GitHub-Pull-Request: golang/go#36104
Reviewed-on: https://go-review.googlesource.com/c/go/+/210999
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/compile/internal/syntax: better scanner error messages
Robert Griesemer [Tue, 11 Feb 2020 06:02:47 +0000 (22:02 -0800)]
cmd/compile/internal/syntax: better scanner error messages

This is one of several changes that were part of a larger rewrite
which I made in early 2019 after switching to the new number literal
syntax implementation. The purpose of the rewrite was to simplify
reading of source code (Unicode character by character) and speed up
the scanner but was never submitted for review due to other priorities.

Part 2 of 3:

This change contains improvements to the scanner error messages:

- Use "rune literal" rather than "character literal" to match the
  spec nomenclature.

- Shorter, more to the point error messages.
  (For instance, "more than one character in rune literal" rather
  than "invalid character literal (more than one character)", etc.)

Change-Id: I1aaf79003374a68dbb05926437ed305cf2a8ec96
Reviewed-on: https://go-review.googlesource.com/c/go/+/221602
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile/internal/syntax: improved scanner tests
Robert Griesemer [Tue, 11 Feb 2020 05:32:04 +0000 (21:32 -0800)]
cmd/compile/internal/syntax: improved scanner tests

This is one of several changes that were part of a larger rewrite
which I made in early 2019 after switching to the new number literal
syntax implementation. The purpose of the rewrite was to simplify
reading of source code (Unicode character by character) and speed up
the scanner but was never submitted for review due to other priorities.

Part 1 of 3:

This change contains improvements to the scanner tests.

Change-Id: Iecfcaef00fdeb690b0db786edbd52e828417141b
Reviewed-on: https://go-review.googlesource.com/c/go/+/221601
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile: use staticuint64s instead of staticbytes
Diogo Pinela [Tue, 3 Mar 2020 21:03:40 +0000 (21:03 +0000)]
cmd/compile: use staticuint64s instead of staticbytes

There are still two places in src/runtime/string.go that use
staticbytes, so we cannot delete it just yet.

There is a new codegen test to verify that the index calculation
is constant-folded, at least on amd64. ppc64, mips[64] and s390x
cannot currently do that.

There is also a new runtime benchmark to ensure that this does not
slow down performance (tested against parent commit):

name                      old time/op  new time/op  delta
ConvT2EByteSized/bool-4   1.07ns ± 1%  1.07ns ± 1%   ~     (p=0.060 n=14+15)
ConvT2EByteSized/uint8-4  1.06ns ± 1%  1.07ns ± 1%   ~     (p=0.095 n=14+15)

Updates #37612

Change-Id: I5ec30738edaa48cda78dfab4a78e24a32fa7fd6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/221957
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
5 years agocmd/go: invalidate cached test results when the -timeout flag changes
Bryan C. Mills [Fri, 13 Dec 2019 20:42:24 +0000 (15:42 -0500)]
cmd/go: invalidate cached test results when the -timeout flag changes

Fixes #36134

Change-Id: Icc5e1269696db778ba5c1e6bebed9969b8841c81
Reviewed-on: https://go-review.googlesource.com/c/go/+/220365
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agocmd/asm: add MIPS MSA LD/ST/LDI support for mips64x
Meng Zhuo [Tue, 3 Mar 2020 15:05:32 +0000 (23:05 +0800)]
cmd/asm: add MIPS MSA LD/ST/LDI support for mips64x

This CL adding primitive asm support of MIPS MSA by introducing
new sets of register W0-W31 (C_WREG) and 12 new instructions:

* VMOV{B,H,W,D} ADDCONST, WREG  (Vector load immediate)
* VMOV{B,H,W,D} SOREG, WREG     (Vector load)
* VMOV{B,H,W,D} WREG, SOREG     (Vector store)

Ref: MIPS Architecture for Programmers Volume IV-j: The MIPS64 SIMD Architecture Module

Change-Id: I3362c59a73c82c94769c18a19a0bee7e5029217d
Reviewed-on: https://go-review.googlesource.com/c/go/+/215723
Run-TryBot: Meng Zhuo <mengzhuo1203@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime: don't save/restore FP registers in softfloat mode on MIPS(64)
Cherry Zhang [Wed, 4 Mar 2020 16:14:53 +0000 (11:14 -0500)]
runtime: don't save/restore FP registers in softfloat mode on MIPS(64)

Fixes #37653.

Change-Id: I6188e44b4bc4aba7b56f29d9ce9de4618c70fd7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/222057
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agobytes, strings: moves indexRabinKarp function to internal/bytealg
erifan01 [Thu, 21 Nov 2019 06:38:25 +0000 (14:38 +0800)]
bytes, strings: moves indexRabinKarp function to internal/bytealg

In order to facilitate optimization of IndexAny and LastIndexAny, this patch moves
three Rabin-Karp related functions indexRabinKarp, hashStr and hashStrRev in strings
package to initernal/bytealg. There are also three functions in the bytes package with
the same names and functions but different parameter types. To highlight this, this
patch also moves them to internal/bytealg and gives them slightly different names.

Related benchmark changes on amd64 and arm64:

name          old time/op    new time/op    delta
pkg:strings goos:linux goarch:amd64
Index-16        14.0ns ± 1%    14.1ns ± 2%    ~     (p=0.738 n=5+5)
LastIndex-16    15.5ns ± 1%    15.7ns ± 4%    ~     (p=0.897 n=5+5)
pkg:bytes goos:linux goarch:amd64
Index/10-16     26.5ns ± 1%    26.5ns ± 0%    ~     (p=0.873 n=5+5)
Index/32-16     26.2ns ± 0%    25.7ns ± 0%  -1.68%  (p=0.008 n=5+5)
Index/4K-16     5.12µs ± 4%    5.14µs ± 2%    ~     (p=0.841 n=5+5)
Index/4M-16     5.44ms ± 3%    5.34ms ± 2%    ~     (p=0.056 n=5+5)
Index/64M-16    85.8ms ± 3%    84.6ms ± 0%  -1.37%  (p=0.016 n=5+5)

name          old speed      new speed      delta
pkg:bytes goos:linux goarch:amd64
Index/10-16    377MB/s ± 1%   377MB/s ± 0%    ~     (p=1.000 n=5+5)
Index/32-16   1.22GB/s ± 1%  1.24GB/s ± 0%  +1.66%  (p=0.008 n=5+5)
Index/4K-16    800MB/s ± 4%   797MB/s ± 2%    ~     (p=0.841 n=5+5)
Index/4M-16    771MB/s ± 3%   786MB/s ± 2%    ~     (p=0.056 n=5+5)
Index/64M-16   783MB/s ± 3%   793MB/s ± 0%  +1.36%  (p=0.016 n=5+5)

name         old time/op   new time/op   delta
pkg:strings goos:linux goarch:arm64
Index-8       22.6ns ± 0%   22.5ns ± 0%    ~     (p=0.167 n=5+5)
LastIndex-8   17.5ns ± 0%   17.5ns ± 0%    ~     (all equal)
pkg:bytes goos:linux goarch:arm64
Index/10-8    25.0ns ± 0%   25.0ns ± 0%    ~     (all equal)
Index/32-8     160ns ± 0%    160ns ± 0%    ~     (all equal)
Index/4K-8    6.26µs ± 0%   6.26µs ± 0%    ~     (p=0.167 n=5+5)
Index/4M-8    6.30ms ± 0%   6.31ms ± 0%    ~     (p=1.000 n=5+5)
Index/64M-8    101ms ± 0%    101ms ± 0%    ~     (p=0.690 n=5+5)

name         old speed     new speed     delta
pkg:bytes goos:linux goarch:arm64
Index/10-8   399MB/s ± 0%  400MB/s ± 0%  +0.08%  (p=0.008 n=5+5)
Index/32-8   200MB/s ± 0%  200MB/s ± 0%    ~     (p=0.127 n=4+5)
Index/4K-8   654MB/s ± 0%  654MB/s ± 0%  +0.01%  (p=0.016 n=5+5)
Index/4M-8   665MB/s ± 0%  665MB/s ± 0%    ~     (p=0.833 n=5+5)
Index/64M-8  665MB/s ± 0%  665MB/s ± 0%    ~     (p=0.913 n=5+5)

Change-Id: Icce3bc162bb8613ac36dc963a46c51f8e82ab842
Reviewed-on: https://go-review.googlesource.com/c/go/+/208638
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agomisc/cgo/test: fix sigaltstack test on AIX
Clément Chigot [Tue, 3 Mar 2020 15:24:32 +0000 (16:24 +0100)]
misc/cgo/test: fix sigaltstack test on AIX

Increase the size of the signal stack as the value given by SIGSTKSZ
is too small for the Go signal handler.

Fixes #37609

Change-Id: I56f1006bc69a2a9fb43f9e0da00061964290a690
Reviewed-on: https://go-review.googlesource.com/c/go/+/221804
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: don't allow NaNs in floating-point constant ops
Keith Randall [Tue, 3 Mar 2020 17:56:20 +0000 (17:56 +0000)]
cmd/compile: don't allow NaNs in floating-point constant ops

Trying this CL again, with a fixed test that allows platforms
to disagree on the exact behavior of converting NaNs.

We store 32-bit floating point constants in a 64-bit field, by
converting that 32-bit float to 64-bit float to store it, and convert
it back to use it.

That works for *almost* all floating-point constants. The exception is
signaling NaNs. The round trip described above means we can't represent
a 32-bit signaling NaN, because conversions strip the signaling bit.

To fix this issue, just forbid NaNs as floating-point constants in SSA
form. This shouldn't affect any real-world code, as people seldom
constant-propagate NaNs (except in test code).

Additionally, NaNs are somewhat underspecified (which of the many NaNs
do you get when dividing 0/0?), so when cross-compiling there's a
danger of using the compiler machine's NaN regime for some math, and
the target machine's NaN regime for other math. Better to use the
target machine's NaN regime always.

Update #36400

Change-Id: Idf203b688a15abceabbd66ba290d4e9f63619ecb
Reviewed-on: https://go-review.googlesource.com/c/go/+/221790
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
5 years agocmd/compile: remove walkinrange optimization
Michael Munday [Tue, 3 Mar 2020 12:44:19 +0000 (12:44 +0000)]
cmd/compile: remove walkinrange optimization

The walkinrange optimization has been superseded by CL 165998.

Has a small positive impact on binary sizes:

compilecmp master -> HEAD
master (e37cc29863): cmd/compile: optimize integer-in-range checks
HEAD (1a70680a34): cmd/compile: remove walkinrange optimization
platform: linux/amd64

file      before    after     Δ       %
addr2line 4329144   4325048   -4096   -0.095%
api       6060970   6056874   -4096   -0.068%
asm       5196905   5192809   -4096   -0.079%
cgo       4898769   4890577   -8192   -0.167%
compile   20222193  20209713  -12480  -0.062%
cover     5331580   5323388   -8192   -0.154%
dist      3732778   3728682   -4096   -0.110%
doc       4748488   4740296   -8192   -0.173%
link      6707380   6695092   -12288  -0.183%
nm        4278685   4274589   -4096   -0.096%
pack      2305038   2300942   -4096   -0.178%
pprof     14874834  14870738  -4096   -0.028%
test2json 2849221   2845125   -4096   -0.144%
vet       8393173   8384981   -8192   -0.098%
go        15205572  15193284  -12288  -0.081%
total     131812292 131709700 -102592 -0.078%

Updates #30645.

Change-Id: I42d74481652c90fef1a9bc58c70836e42c9b1c4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/221802
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
5 years agocmd/compile: simplify converted SSA form for 'if false'
Josh Bleecher Snyder [Mon, 2 Mar 2020 21:51:20 +0000 (13:51 -0800)]
cmd/compile: simplify converted SSA form for 'if false'

The goal here is to make it easier for a human to
examine the SSA when a function contains lots of dead code.

No significant compiler metric or generated code differences.

Change-Id: I81915fa4639bc8820cc9a5e45e526687d0d1f57a
Reviewed-on: https://go-review.googlesource.com/c/go/+/221791
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoall: fix two minor typos in comments
Josh Bleecher Snyder [Tue, 9 May 2017 19:48:23 +0000 (12:48 -0700)]
all: fix two minor typos in comments

Change-Id: Iec6cd81c9787d3419850aa97e75052956ad139bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/221789
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agonet/http: fix handling of HTTP/2 upgrade failures
Russ Cox [Tue, 25 Feb 2020 18:01:59 +0000 (13:01 -0500)]
net/http: fix handling of HTTP/2 upgrade failures

If an error occurs during the HTTP/2 upgrade phase, originally this
resulted in a pconn with pconn.alt set to an http2erringRoundTripper,
which always fails. This is not wanted - we want to retry in this case.

CL 202078 added a check for the http2erringRoundTripper to treat it
as a failed pconn, but the handling of the failure was wrong in the case
where the pconn is not in the idle list at all (common in HTTP/2).
This made the added test TestDontCacheBrokenHTTP2Conn flaky.

CL 218097 (unsubmitted) proposed to expand the handling of the
http2erringRoundTripper after the new check, to dispose of the pconn
more thoroughly. Bryan Mills pointed out in that review that we probably
shouldn't make the never-going-to-work pconn in the first place.

This CL changes the upgrade phase look for the http2erringRoundTripper
and return the underlying error instead of claiming to have a working
connection. Having done that, the CL undoes the change in CL 202078
and with it the need for CL 218097, but it keeps the new test added
by CL 202078.

On my laptop, before this commit, TestDontCacheBrokenHTTP2Conn
failed 66 times out of 20,000. With this commit, I see 0 out of 20,000.

Fixes #34978.
Fixes #35113.

Change-Id: Ibd908b63c2ae96e159e8e604213d8373afb350e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/220905
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoencoding/hex: remove unused variable from BenchmarkDump
Tim Cooper [Tue, 3 Mar 2020 13:08:06 +0000 (07:08 -0600)]
encoding/hex: remove unused variable from BenchmarkDump

Change-Id: I1fd47e5eab27346cec488098d4f6102a0749bd28
Reviewed-on: https://go-review.googlesource.com/c/go/+/221788
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: optimize integer-in-range checks
Michael Munday [Mon, 20 May 2019 18:55:56 +0000 (11:55 -0700)]
cmd/compile: optimize integer-in-range checks

This CL incorporates code from CL 201206 by Josh Bleecher Snyder
(thanks Josh).

This CL restores the integer-in-range optimizations in the SSA
backend. The fuse pass is enhanced to detect inequalities that
could be merged and fuse their associated blocks while the generic
rules optimize them into a single unsigned comparison.

For example, the inequality `x >= 0 && x < 10` will now be optimized
to `unsigned(x) < 10`.

Overall has a fairly positive impact on binary sizes.

name                      old time/op       new time/op       delta
Template                        192ms ± 1%        192ms ± 1%    ~     (p=0.757 n=17+18)
Unicode                        76.6ms ± 2%       76.5ms ± 2%    ~     (p=0.603 n=19+19)
GoTypes                         694ms ± 1%        693ms ± 1%    ~     (p=0.569 n=19+20)
Compiler                        3.26s ± 0%        3.27s ± 0%  +0.25%  (p=0.000 n=20+20)
SSA                             7.41s ± 0%        7.49s ± 0%  +1.10%  (p=0.000 n=17+19)
Flate                           120ms ± 1%        120ms ± 1%  +0.38%  (p=0.003 n=19+19)
GoParser                        152ms ± 1%        152ms ± 1%    ~     (p=0.061 n=17+19)
Reflect                         422ms ± 1%        425ms ± 2%  +0.76%  (p=0.001 n=18+20)
Tar                             167ms ± 1%        167ms ± 0%    ~     (p=0.730 n=18+19)
XML                             233ms ± 4%        231ms ± 1%    ~     (p=0.752 n=20+17)
LinkCompiler                    927ms ± 8%        928ms ± 8%    ~     (p=0.857 n=19+20)
ExternalLinkCompiler            1.81s ± 2%        1.81s ± 2%    ~     (p=0.513 n=19+20)
LinkWithoutDebugCompiler        556ms ±10%        583ms ±13%  +4.95%  (p=0.007 n=20+20)
[Geo mean]                      478ms             481ms       +0.52%

name                      old user-time/op  new user-time/op  delta
Template                        270ms ± 5%        269ms ± 7%    ~     (p=0.925 n=20+20)
Unicode                         134ms ± 7%        131ms ±14%    ~     (p=0.593 n=18+20)
GoTypes                         981ms ± 3%        987ms ± 2%  +0.63%  (p=0.049 n=19+18)
Compiler                        4.50s ± 2%        4.50s ± 1%    ~     (p=0.588 n=19+20)
SSA                             10.6s ± 2%        10.6s ± 1%    ~     (p=0.141 n=20+19)
Flate                           164ms ± 8%        165ms ±10%    ~     (p=0.738 n=20+20)
GoParser                        202ms ± 5%        203ms ± 6%    ~     (p=0.820 n=20+20)
Reflect                         587ms ± 6%        597ms ± 3%    ~     (p=0.087 n=20+18)
Tar                             230ms ± 6%        228ms ± 8%    ~     (p=0.569 n=19+20)
XML                             311ms ± 6%        314ms ± 5%    ~     (p=0.369 n=20+20)
LinkCompiler                    878ms ± 8%        887ms ± 7%    ~     (p=0.289 n=20+20)
ExternalLinkCompiler            1.60s ± 7%        1.60s ± 7%    ~     (p=0.820 n=20+20)
LinkWithoutDebugCompiler        498ms ±12%        489ms ±11%    ~     (p=0.398 n=20+20)
[Geo mean]                      611ms             611ms       +0.05%

name                      old alloc/op      new alloc/op      delta
Template                       36.1MB ± 0%       36.0MB ± 0%  -0.32%  (p=0.000 n=20+20)
Unicode                        28.3MB ± 0%       28.3MB ± 0%  -0.03%  (p=0.000 n=19+20)
GoTypes                         121MB ± 0%        121MB ± 0%    ~     (p=0.226 n=16+20)
Compiler                        563MB ± 0%        563MB ± 0%    ~     (p=0.166 n=20+19)
SSA                            1.32GB ± 0%       1.33GB ± 0%  +0.88%  (p=0.000 n=20+19)
Flate                          22.7MB ± 0%       22.7MB ± 0%  -0.02%  (p=0.033 n=19+20)
GoParser                       27.9MB ± 0%       27.9MB ± 0%  -0.02%  (p=0.001 n=20+20)
Reflect                        78.3MB ± 0%       78.2MB ± 0%  -0.01%  (p=0.019 n=20+20)
Tar                            34.0MB ± 0%       34.0MB ± 0%  -0.04%  (p=0.000 n=20+20)
XML                            43.9MB ± 0%       43.9MB ± 0%  -0.07%  (p=0.000 n=20+19)
LinkCompiler                    205MB ± 0%        205MB ± 0%  +0.44%  (p=0.000 n=20+18)
ExternalLinkCompiler            223MB ± 0%        223MB ± 0%  +0.03%  (p=0.000 n=20+20)
LinkWithoutDebugCompiler        139MB ± 0%        142MB ± 0%  +1.75%  (p=0.000 n=20+20)
[Geo mean]                     93.7MB            93.9MB       +0.20%

name                      old allocs/op     new allocs/op     delta
Template                         363k ± 0%         361k ± 0%  -0.58%  (p=0.000 n=20+19)
Unicode                          329k ± 0%         329k ± 0%  -0.06%  (p=0.000 n=19+20)
GoTypes                         1.28M ± 0%        1.28M ± 0%  -0.01%  (p=0.000 n=20+20)
Compiler                        5.40M ± 0%        5.40M ± 0%  -0.01%  (p=0.000 n=20+20)
SSA                             12.7M ± 0%        12.8M ± 0%  +0.80%  (p=0.000 n=20+20)
Flate                            228k ± 0%         228k ± 0%    ~     (p=0.194 n=20+20)
GoParser                         295k ± 0%         295k ± 0%  -0.04%  (p=0.000 n=20+20)
Reflect                          949k ± 0%         949k ± 0%  -0.01%  (p=0.000 n=20+20)
Tar                              337k ± 0%         337k ± 0%  -0.06%  (p=0.000 n=20+20)
XML                              418k ± 0%         417k ± 0%  -0.17%  (p=0.000 n=20+20)
LinkCompiler                     553k ± 0%         554k ± 0%  +0.22%  (p=0.000 n=20+19)
ExternalLinkCompiler            1.52M ± 0%        1.52M ± 0%  +0.27%  (p=0.000 n=20+20)
LinkWithoutDebugCompiler         186k ± 0%         186k ± 0%  +0.06%  (p=0.000 n=20+20)
[Geo mean]                       723k              723k       +0.03%

name                      old text-bytes    new text-bytes    delta
HelloSize                       828kB ± 0%        828kB ± 0%  -0.01%  (p=0.000 n=20+20)

name                      old data-bytes    new data-bytes    delta
HelloSize                      13.4kB ± 0%       13.4kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       180kB ± 0%        180kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.23MB ± 0%       1.23MB ± 0%  -0.33%  (p=0.000 n=20+20)

file      before    after     Δ       %
addr2line 4320075   4311883   -8192   -0.190%
asm       5191932   5187836   -4096   -0.079%
buildid   2835338   2831242   -4096   -0.144%
compile   20531717  20569099  +37382  +0.182%
cover     5322511   5318415   -4096   -0.077%
dist      3723749   3719653   -4096   -0.110%
doc       4743515   4739419   -4096   -0.086%
fix       3413960   3409864   -4096   -0.120%
link      6690119   6686023   -4096   -0.061%
nm        4269616   4265520   -4096   -0.096%
pprof     14942189  14929901  -12288  -0.082%
trace     11807164  11790780  -16384  -0.139%
vet       8384104   8388200   +4096   +0.049%
go        15339076  15334980  -4096   -0.027%
total     132258257 132226007 -32250  -0.024%

Fixes #30645.

Change-Id: If551ac5996097f3685870d083151b5843170aab0
Reviewed-on: https://go-review.googlesource.com/c/go/+/165998
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: absorb SNEZ into branch on riscv64
Joel Sing [Sun, 1 Mar 2020 17:25:54 +0000 (04:25 +1100)]
cmd/compile: absorb SNEZ into branch on riscv64

Change-Id: I55fd93843a7fb574a7dd66ebb87fdd96e944d555
Reviewed-on: https://go-review.googlesource.com/c/go/+/221682
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: optimize subtraction of zero on riscv64
Joel Sing [Sun, 1 Mar 2020 17:24:35 +0000 (04:24 +1100)]
cmd/compile: optimize subtraction of zero on riscv64

Change-Id: I9a994b01e9fecb13077c30df4b7677d40d179cce
Reviewed-on: https://go-review.googlesource.com/c/go/+/221681
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: improve subtraction of constants on riscv64
Joel Sing [Sun, 1 Mar 2020 17:23:12 +0000 (04:23 +1100)]
cmd/compile: improve subtraction of constants on riscv64

Convert subtraction of a constant into an ADDI with a negative immediate,
where possible.

Change-Id: Ie8d54b7538f0012e5f898abea233b2957fe31899
Reviewed-on: https://go-review.googlesource.com/c/go/+/221679
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime: use CBZ/CBNZ in linux/arm64 assembly code
Xiangdong Ji [Thu, 21 Nov 2019 07:46:37 +0000 (07:46 +0000)]
runtime: use CBZ/CBNZ in linux/arm64 assembly code

Replace compare and branch on zero/non-zero instructions in linux/arm64
assembly files with CBZ/CBNZ.

Change-Id: I4dbf56678f85827e83b5863804368bc28a4603b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/209617
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agodoc/mem: remove unnecessary pre tags within same snippet
Jingwei [Sat, 14 Dec 2019 07:52:17 +0000 (15:52 +0800)]
doc/mem: remove unnecessary pre tags within same snippet

currently the snippet is segmented but should be one code snippet.

Change-Id: Ic747faf9bb1b52f9d1786eca70616a05b71ee801
Reviewed-on: https://go-review.googlesource.com/c/go/+/211198
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agocmd/compile/internal/riscv64: correct ssa.BlockRetJmp
Joel Sing [Sun, 1 Mar 2020 17:26:21 +0000 (04:26 +1100)]
cmd/compile/internal/riscv64: correct ssa.BlockRetJmp

The obj.Prog needs to be an obj.ARET rather than an obj.AJMP, otherwise the
epilogue does not get correctly produced.

Change-Id: Ie1262f2028d3b51720eeb0364a627fbde8b14df9
Reviewed-on: https://go-review.googlesource.com/c/go/+/221683
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoflag: changed flag variable name in package doc, for clarity
yuz [Sun, 1 Mar 2020 12:35:56 +0000 (21:35 +0900)]
flag: changed flag variable name in package doc, for clarity

Changed the flag variable name to nFlag instead of flagname,
because flagname was confusing.

Change-Id: I20dd4c4b4f605395d427a125ba4fd14580e5d766
Reviewed-on: https://go-review.googlesource.com/c/go/+/221678
Reviewed-by: Rob Pike <r@golang.org>
5 years agoruntime: during panic, print value instead of address, if kind is printable
Emmanuel T Odeke [Mon, 2 Mar 2020 01:41:44 +0000 (17:41 -0800)]
runtime: during panic, print value instead of address, if kind is printable

Make panics more useful by printing values, if their
underlying kind is printable, instead of just their memory address.

Thus now given any custom type derived from any of:
    float*, int*, string, uint*

if we have panic with such a result, its value will be printed.

Thus given any of:
    type MyComplex128 complex128
    type MyFloat64 float64
    type MyString string
    type MyUintptr uintptr

    panic(MyComplex128(32.1 + 10i))
    panic(MyFloat64(-93.7))
    panic(MyString("This one"))
    panic(MyUintptr(93))

They will now print in the panic:

    panic: main.MyComplex64(+1.100000e-001+3.000000e+000i)
    panic: main.MyFloat64(-9.370000e+001)
    panic: main.MyString("This one")
    panic: main.MyUintptr(93)

instead of:

    panic: (main.MyComplex128) (0xe0100,0x138cc0)
    panic: (main.MyFloat64) (0xe0100,0x138068)
    panic: (main.MyString) (0x48aa00,0x4c0840)
    panic: (main.MyUintptr) (0xe0100,0x137e58)

and anything else will be printed as in the past with:

    panic: (main.MyStruct) (0xe4ee0,0x40a0e0)

Also while here, updated the Go1.15 release notes.

Fixes #37531

Change-Id: Ia486424344a386014f2869ab3483e42a9ef48ac4
Reviewed-on: https://go-review.googlesource.com/c/go/+/221779
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile/internal/syntax: add -skip flag to exclude files from TestStdLib
Robert Griesemer [Sat, 29 Feb 2020 06:25:39 +0000 (22:25 -0800)]
cmd/compile/internal/syntax: add -skip flag to exclude files from TestStdLib

TestStdLib reports parsed lines and lines/s information. To make
it easier to compare apples to apples when making changes in the
std lib, a regular expression provided via the -skip flag filters
files we don't want to process.

Change-Id: I27d9c32032eac4e78581205892e4f26947c91bd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/221600
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agoruntime: prevent allocation when converting small ints to interfaces
Josh Bleecher Snyder [Mon, 27 Jan 2020 19:28:05 +0000 (11:28 -0800)]
runtime: prevent allocation when converting small ints to interfaces

Prior to this change, we avoid allocation when
converting 0 to an interface.

This change extends that optimization to larger value types
whose values happens to be in the range 0 to 255.
This is marginally more expensive in the case of a 0 value,
in that the address is computed rather than fixed.

name                         old time/op  new time/op  delta
ConvT2ESmall-8               2.36ns ± 4%  2.65ns ± 4%  +12.23%  (p=0.000 n=87+91)
ConvT2EUintptr-8             2.36ns ± 4%  2.84ns ± 6%  +20.05%  (p=0.000 n=96+99)
ConvT2ELarge-8               23.8ns ± 2%  23.1ns ± 3%   -2.94%  (p=0.000 n=93+95)
ConvT2ISmall-8               2.67ns ± 5%  2.74ns ±27%     ~     (p=0.214 n=99+100)
ConvT2IUintptr-8             2.65ns ± 5%  2.46ns ± 5%   -7.19%  (p=0.000 n=98+98)
ConvT2ILarge-8               24.2ns ± 2%  23.5ns ± 4%   -3.16%  (p=0.000 n=91+97)
ConvT2Ezero/zero/16-8        2.79ns ± 6%  2.99ns ± 4%   +7.52%  (p=0.000 n=94+88)
ConvT2Ezero/zero/32-8        2.34ns ± 3%  2.65ns ± 3%  +13.06%  (p=0.000 n=92+98)
ConvT2Ezero/zero/64-8        2.35ns ± 4%  2.65ns ± 6%  +12.86%  (p=0.000 n=99+94)
ConvT2Ezero/zero/str-8       2.55ns ± 4%  2.54ns ± 4%     ~     (p=0.063 n=97+99)
ConvT2Ezero/zero/slice-8     2.82ns ± 4%  2.85ns ± 5%   +1.00%  (p=0.000 n=99+95)
ConvT2Ezero/zero/big-8       94.3ns ± 5%  93.4ns ± 4%   -0.94%  (p=0.000 n=88+90)
ConvT2Ezero/nonzero/str-8    29.6ns ± 3%  27.7ns ± 3%   -6.69%  (p=0.000 n=98+97)
ConvT2Ezero/nonzero/slice-8  36.6ns ± 2%  37.1ns ± 2%   +1.31%  (p=0.000 n=94+90)
ConvT2Ezero/nonzero/big-8    93.4ns ± 3%  92.7ns ± 3%   -0.74%  (p=0.000 n=88+84)
ConvT2Ezero/smallint/16-8    13.3ns ± 4%   2.7ns ± 6%  -79.82%  (p=0.000 n=100+97)
ConvT2Ezero/smallint/32-8    12.5ns ± 1%   2.9ns ± 5%  -77.17%  (p=0.000 n=85+96)
ConvT2Ezero/smallint/64-8    14.7ns ± 3%   2.6ns ± 3%  -82.05%  (p=0.000 n=94+94)
ConvT2Ezero/largeint/16-8    14.0ns ± 4%  13.2ns ± 7%   -5.44%  (p=0.000 n=95+99)
ConvT2Ezero/largeint/32-8    12.8ns ± 4%  12.9ns ± 3%     ~     (p=0.096 n=99+87)
ConvT2Ezero/largeint/64-8    15.5ns ± 2%  15.0ns ± 2%   -3.46%  (p=0.000 n=95+96)

An example of a program for which this makes a perceptible difference
is running the compiler with the -S flag:

name        old time/op       new time/op       delta
Template          349ms ± 2%        344ms ± 2%   -1.48%  (p=0.000 n=23+25)
Unicode           138ms ± 4%        136ms ± 3%   -1.67%  (p=0.003 n=25+25)
GoTypes           1.25s ± 2%        1.24s ± 2%   -1.11%  (p=0.001 n=24+25)
Compiler          5.73s ± 2%        5.67s ± 2%   -1.09%  (p=0.002 n=25+24)
SSA               20.2s ± 2%        19.9s ± 2%   -1.45%  (p=0.000 n=25+23)
Flate             216ms ± 4%        210ms ± 2%   -2.77%  (p=0.000 n=25+24)
GoParser          283ms ± 2%        278ms ± 3%   -1.58%  (p=0.000 n=23+23)
Reflect           757ms ± 2%        745ms ± 2%   -1.58%  (p=0.000 n=25+25)
Tar               303ms ± 4%        296ms ± 2%   -2.20%  (p=0.000 n=22+23)
XML               415ms ± 2%        411ms ± 3%   -0.94%  (p=0.002 n=25+22)
[Geo mean]        726ms             715ms        -1.59%

name        old user-time/op  new user-time/op  delta
Template          434ms ± 3%        427ms ± 2%   -1.66%  (p=0.000 n=23+24)
Unicode           204ms ±12%        198ms ±12%   -2.83%  (p=0.032 n=25+25)
GoTypes           1.59s ± 2%        1.56s ± 2%   -1.64%  (p=0.000 n=22+25)
Compiler          7.50s ± 1%        7.40s ± 2%   -1.32%  (p=0.000 n=25+25)
SSA               27.2s ± 2%        26.8s ± 2%   -1.50%  (p=0.000 n=24+23)
Flate             266ms ± 6%        254ms ± 3%   -4.38%  (p=0.000 n=25+25)
GoParser          357ms ± 2%        351ms ± 2%   -1.90%  (p=0.000 n=24+23)
Reflect           966ms ± 2%        947ms ± 2%   -1.94%  (p=0.000 n=24+25)
Tar               387ms ± 2%        380ms ± 3%   -1.83%  (p=0.000 n=22+24)
XML               538ms ± 1%        532ms ± 1%   -1.15%  (p=0.000 n=24+20)
[Geo mean]        942ms             923ms        -2.02%

name        old alloc/op      new alloc/op      delta
Template         54.1MB ± 0%       52.9MB ± 0%   -2.26%  (p=0.000 n=25+25)
Unicode          33.5MB ± 0%       33.1MB ± 0%   -1.03%  (p=0.000 n=25+24)
GoTypes           189MB ± 0%        185MB ± 0%   -2.27%  (p=0.000 n=25+25)
Compiler          875MB ± 0%        858MB ± 0%   -1.99%  (p=0.000 n=23+25)
SSA              3.19GB ± 0%       3.13GB ± 0%   -1.95%  (p=0.000 n=25+25)
Flate            32.9MB ± 0%       32.2MB ± 0%   -2.26%  (p=0.000 n=25+25)
GoParser         44.0MB ± 0%       42.9MB ± 0%   -2.33%  (p=0.000 n=25+25)
Reflect           117MB ± 0%        114MB ± 0%   -2.60%  (p=0.000 n=25+25)
Tar              48.6MB ± 0%       47.5MB ± 0%   -2.18%  (p=0.000 n=25+24)
XML              65.7MB ± 0%       64.4MB ± 0%   -1.96%  (p=0.000 n=23+25)
[Geo mean]        118MB             115MB        -2.08%

name        old allocs/op     new allocs/op     delta
Template          1.07M ± 0%        0.92M ± 0%  -14.29%  (p=0.000 n=25+25)
Unicode            539k ± 0%         494k ± 0%   -8.27%  (p=0.000 n=25+25)
GoTypes           3.97M ± 0%        3.43M ± 0%  -13.71%  (p=0.000 n=24+25)
Compiler          17.6M ± 0%        15.4M ± 0%  -12.69%  (p=0.000 n=25+24)
SSA               66.1M ± 0%        58.1M ± 0%  -12.17%  (p=0.000 n=25+25)
Flate              629k ± 0%         536k ± 0%  -14.73%  (p=0.000 n=24+24)
GoParser           929k ± 0%         799k ± 0%  -13.96%  (p=0.000 n=25+25)
Reflect           2.49M ± 0%        2.11M ± 0%  -15.28%  (p=0.000 n=25+25)
Tar                919k ± 0%         788k ± 0%  -14.30%  (p=0.000 n=25+25)
XML               1.28M ± 0%        1.11M ± 0%  -12.85%  (p=0.000 n=24+25)
[Geo mean]        2.32M             2.01M       -13.24%

There is a slight increase in binary size from this change:

file      before    after     Δ       %
addr2line 4307728   4307760   +32     +0.001%
api       5972680   5972728   +48     +0.001%
asm       5114200   5114232   +32     +0.001%
buildid   2843720   2847848   +4128   +0.145%
cgo       4823736   4827864   +4128   +0.086%
compile   24912056  24912104  +48     +0.000%
cover     5259800   5259832   +32     +0.001%
dist      3665080   3665128   +48     +0.001%
doc       4672712   4672744   +32     +0.001%
fix       3376952   3376984   +32     +0.001%
link      6618008   6622152   +4144   +0.063%
nm        4253280   4257424   +4144   +0.097%
objdump   4655376   4659504   +4128   +0.089%
pack      2294280   2294328   +48     +0.002%
pprof     14747476  14751620  +4144   +0.028%
test2json 2819320   2823448   +4128   +0.146%
trace     11665068  11669212  +4144   +0.036%
vet       8342360   8342408   +48     +0.001%

Change-Id: I38ef70244e23069bfd14334061d43ae22a294519
Reviewed-on: https://go-review.googlesource.com/c/go/+/216401
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: regenerate rules
Josh Bleecher Snyder [Mon, 2 Mar 2020 21:57:17 +0000 (13:57 -0800)]
cmd/compile: regenerate rules

CL 210897 went in concurrently with some rulegen.go changes.
Regenerate.

Change-Id: I39ffa8bdffdfcc7f60cc8158d188fb1a3e70fcb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/221787
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agogo/types: simplify method set computation
Robert Griesemer [Sat, 8 Feb 2020 00:01:01 +0000 (16:01 -0800)]
go/types: simplify method set computation

After fixing #37081 we don't need to explicitly keep track of
field collisions in the method set computation anymore; we only
need to know which field (names) exists at each embedding level.
Simplify the code by removing the dedicated fieldSet data type
in favor of a simple string set.

Follow-up on https://golang.org/cl/218617; separate CL to make it
easier to identify a problem with these two changes, should there
be one.

Updates #37081.

Change-Id: I5c259c63c75a148a42d5c3e1e4860e1ffe5631bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/218618
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agogo/types: fix method set computation
Robert Griesemer [Fri, 7 Feb 2020 23:26:19 +0000 (15:26 -0800)]
go/types: fix method set computation

When computing method sets, any struct field that "shadows" a
method at a lower embedding level eliminates that method from
the method set. Treat any field at a given level as a "collision"
for any methods at lower embedding level.

Method sets are not directly used by go/types (except for self-
verification in debug mode); they are a functionality provided
by go/types. Thus, the method sets that go/types is using were
not affected by this bug.

Fixes #37081.

Change-Id: Ic1937e01891b3614a6f7965d4384aeb485f3fe3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/218617
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agocmd/compile: add -d=ssa/check/seed=SEED
Josh Bleecher Snyder [Fri, 24 Jan 2020 21:52:41 +0000 (13:52 -0800)]
cmd/compile: add -d=ssa/check/seed=SEED

This change adds the option to run the ssa checker with a random seed.
The current system uses a completely fixed seed,
which is good for reproducibility but bad for exploring the state space.

Preserve what we have, but also provide a way for the caller
to provide a seed. The caller can report the seed
alongside any failures.

Change-Id: I2676a8112d8260e6cac86d95d2e8db4d3221aeeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/216418
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: remove duplicate ppc64 rules
Josh Bleecher Snyder [Thu, 6 Feb 2020 18:36:29 +0000 (10:36 -0800)]
cmd/compile: remove duplicate ppc64 rules

Const64 gets lowered to MOVDconst.
Change rules using interior Const64 to use MOVDconst instead,
to be less dependent on rule application order.

As a result of doing this, some of the rules end up being
exact duplicates; remove those.

We had those exact duplicates because of the order dependency;
ppc64 had no way to optimize away shifts by a constant
if the initial lowering didn't catch it.

Add those optimizations as well.
The outcome is the same, but this makes the overall rules more robust.

Change-Id: Iadd97a9fe73d52358d571d022ace145e506d160b
Reviewed-on: https://go-review.googlesource.com/c/go/+/220877
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
5 years agoruntime: print instruction bytes when reporting a SIGILL
Keith Randall [Fri, 28 Feb 2020 20:59:38 +0000 (12:59 -0800)]
runtime: print instruction bytes when reporting a SIGILL

Print the bytes of the instruction that generated a SIGILL.
This should help us respond to bug reports without having to
go back-and-forth with the reporter to get the instruction involved.
Might also help with SIGILL problems that are difficult to reproduce.

Update #37513

Change-Id: I33059b1dbfc97bce16142a843f32a88a6547e280
Reviewed-on: https://go-review.googlesource.com/c/go/+/221431
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: make pre-elimination of rulegen bounds checks more precise
Josh Bleecher Snyder [Mon, 2 Mar 2020 00:44:06 +0000 (16:44 -0800)]
cmd/compile: make pre-elimination of rulegen bounds checks more precise

In cases in which we had a named value whose args were all _,
like this rule from ARM.rules:

(MOVBUreg x:(MOVBUload _ _)) -> (MOVWreg x)

We previously inserted

_ = x.Args[1]

even though it is unnecessary.
This change eliminates this pointless bounds check.
And in other cases, we now check bounds just as far as strictly necessary.

No significant movement on any compiler metrics.
Just nicer (and less) code.

Passes toolstash-check -all.

Change-Id: I075dfe9f926cc561cdc705e9ddaab563164bed3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/221781
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: add streamlined Block Reset+AddControl routines
Josh Bleecher Snyder [Sun, 1 Mar 2020 21:09:09 +0000 (13:09 -0800)]
cmd/compile: add streamlined Block Reset+AddControl routines

For use in rewrite rules. Shrinks cmd/compile:

compile 20082104  19967416  -114688 -0.571%

Passes toolstash-check -all.

Change-Id: Ic856508b27ec5b7fb9b6ca63e955a7139ae7dc30
Reviewed-on: https://go-review.googlesource.com/c/go/+/221780
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoruntime: use quiet NaNs in softfloat implementation
Keith Randall [Fri, 28 Feb 2020 23:42:03 +0000 (15:42 -0800)]
runtime: use quiet NaNs in softfloat implementation

Update #37455

Change-Id: Ieac0823aa398d73187c009037be15ba34c84f3d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/221433
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agohash/maphash: add more tests for seed generation
Keith Randall [Mon, 24 Feb 2020 03:23:15 +0000 (19:23 -0800)]
hash/maphash: add more tests for seed generation

Test all the paths by which a Hash picks its seed.
Make sure they all behave identically to a preset seed.

Change-Id: I2f7950857697f2f07226b96655574c36931b2aae
Reviewed-on: https://go-review.googlesource.com/c/go/+/220686
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Vladimir Evgrafov <evgrafov.vladimir@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agocmd/compile: add specialized Value reset for OpCopy
Josh Bleecher Snyder [Wed, 30 Oct 2019 17:29:47 +0000 (10:29 -0700)]
cmd/compile: add specialized Value reset for OpCopy

This:

* Simplifies and shortens the generated code for rewrite rules.
* Shrinks cmd/compile by 86k (0.4%) and makes it easier to compile.
* Removes the stmt boundary code wrangling from Value.reset,
  in favor of doing it in the one place where it actually does some work,
  namely the writebarrier pass. (This was ascertained by inspecting the
  code for cases in which notStmtBoundary values were generated.)

Passes toolstash-check -all.

Change-Id: I25671d4c4bbd772f235195d11da090878ea2cc07
Reviewed-on: https://go-review.googlesource.com/c/go/+/221421
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/compile: add intrinsics for runtime/internal/math on MIPS64x
Meng Zhuo [Sat, 29 Feb 2020 03:23:29 +0000 (11:23 +0800)]
cmd/compile: add intrinsics for runtime/internal/math on MIPS64x

name              old time/op  new time/op  delta
MulUintptr/small  8.42ns ± 0%  5.93ns ± 0%  -29.66%  (p=0.000 n=9+10)
MulUintptr/large  11.1ns ± 0%   7.4ns ± 0%  -33.17%  (p=0.000 n=10+9)

Change-Id: I6659a886389660461fc2c90bd248243f6e7c29d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/210897
Run-TryBot: Meng Zhuo <mengzhuo1203@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agonet/http: verify RoundTripper invariants in the send function
Bryan C. Mills [Mon, 2 Mar 2020 15:16:39 +0000 (10:16 -0500)]
net/http: verify RoundTripper invariants in the send function

Issue #37598 reports a nil-panic in *Client.send that can
only occur if one of the RoundTripper invariants is violated.
Unfortunately, that condition is currently difficult to diagnose: it
manifests as a panic during a Response field access, rather than
something the user can easily associate with an specific erroneous
RoundTripper implementation.

No test because the new code paths are supposed to be unreachable.

Updates #37598

Change-Id: If0451e9c6431f6fab7137de43727297a80def05b
Reviewed-on: https://go-review.googlesource.com/c/go/+/221818
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: race condition in unsynchronized send/close
Changkun Ou [Sun, 16 Feb 2020 00:11:53 +0000 (01:11 +0100)]
doc: race condition in unsynchronized send/close

This CL documents that unsynchronized send and close operations
on a channel are detected as a race condition.

Fixes #27769

Change-Id: I7495a2d0dd834c3f3b6339f8ca18ea21ae979aa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/219637
Reviewed-by: Rob Pike <r@golang.org>
5 years agointernal/cpu: use anonymous struct for CPU feature vars
Tobias Klauser [Mon, 2 Mar 2020 08:31:44 +0000 (09:31 +0100)]
internal/cpu: use anonymous struct for CPU feature vars

Like in x/sys/cpu, use anonymous structs to declare the CPU feature vars
instead of defining single-use types. Also, order the vars
alphabetically.

Change-Id: Iedd3ca51916e3cbb852d2aeed18b3a4c6613e778
Reviewed-on: https://go-review.googlesource.com/c/go/+/221757
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
5 years agoos: plan9 seek() should invalidate cached directory info
Keith Randall [Mon, 2 Mar 2020 01:40:35 +0000 (17:40 -0800)]
os: plan9 seek() should invalidate cached directory info

Update #37161

Change-Id: Iee828bbcc8436af29ca6dd9ed897cb5265a57cf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/221778
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agotime: use values larger than 24 for day for time.Format examples
Jean de Klerk [Sun, 1 Mar 2020 00:35:51 +0000 (17:35 -0700)]
time: use values larger than 24 for day for time.Format examples

Currently, the time.Format docs use 7 Mar 2015 as the day/month/year. In numeric
form, that is either 7/3/2015 or 3/7/2015 depending on which part of the world
you're from. This is extremely confusing.

In fact, the reference time being defined in a very US-centric way is quite
confusing for the rest of the world, too [1].

We can't change that, but we can make the time.Format docs more comprehendable
to the rest of the world without sacrificing by simply choosing a day that is
not ambiguous (a value greater than 24 for day). This CL does makes the
necessary change.

Note: this CL moves some of the padding examples into their own example, since
those examples do need a <10 day to demonstrate padding.

1: Additional context: a very old golang-nuts thread in which Rob expresses some
regret about the format being the USA standard, rather than the alternative:
https://groups.google.com/forum/m/#!msg/golang-nuts/0nQbfyNzk9E/LWbMgpRQNOgJ.

Change-Id: If0a07c5e0dab86f8420cbf59543405eb857aa7f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/221612
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 years agoos: seek should invalidate any cached directory reads
Keith Randall [Wed, 12 Feb 2020 01:49:52 +0000 (17:49 -0800)]
os: seek should invalidate any cached directory reads

When we seek on the underlying FD, discard any directory entries
we've already read and cached. This makes sure we won't return
the same entry twice.

We already fixed this for Darwin in CL 209961.

Fixes #37161

Change-Id: I20e1ac8d751443135e67fb4c43c18d69befb643b
Reviewed-on: https://go-review.googlesource.com/c/go/+/219143
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall/js: improve documentation of js.FuncOf
Torben Schinke [Sun, 1 Mar 2020 20:07:46 +0000 (20:07 +0000)]
syscall/js: improve documentation of js.FuncOf

The existing documentation is improved to be more
explicit about the lifecycle and its consequences.

Fixes #34324

Change-Id: I9969afc69f6eeb7812c11fe821a842794df5aa5b
GitHub-Last-Rev: 246a4991660927f88f48290580e96b15c16663c1
GitHub-Pull-Request: golang/go#34551
Reviewed-on: https://go-review.googlesource.com/c/go/+/197458
Reviewed-by: Richard Musiol <neelance@gmail.com>
5 years agosyscall: fix Fchdir on js/wasm
Richard Musiol [Sun, 1 Mar 2020 16:01:58 +0000 (17:01 +0100)]
syscall: fix Fchdir on js/wasm

NodeJS does not support fchdir so it has to be emulated with chdir by
saving the path when opening a directory.

However, if the path opened is relative, saving this path is not
sufficient, because after changing the working directory the path
does not resolve correctly any more, thus a subsequent fd.Chdir() fails.

This change fixes the issue by resolving a relative path when
opening the directory and saving the absolute path instead.

Fixes #37448

Change-Id: Id6bc8c4232b0019fc11e850599a526336608ce54
Reviewed-on: https://go-review.googlesource.com/c/go/+/221717
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agocmd/compile: add specialized AddArgN functions for rewrite rules
Josh Bleecher Snyder [Wed, 26 Feb 2020 19:29:34 +0000 (11:29 -0800)]
cmd/compile: add specialized AddArgN functions for rewrite rules

This shrinks the compiler without impacting performance.
(The performance-sensitive part of rewrite rules is the non-match case.)
Passes toolstash-check -all.

Executable size:

file    before    after     Δ       %
compile 20356168  20163960  -192208 -0.944%
total   115599376 115407168 -192208 -0.166%

Text size:

file                       before   after    Δ       %
cmd/compile/internal/ssa.s 3928309  3778774  -149535 -3.807%
total                      18862943 18713408 -149535 -0.793%

Memory allocated compiling package SSA:

SSA               12.7M ± 0%        12.5M ± 0%  -1.74%  (p=0.008 n=5+5)

Compiler speed impact:

name        old time/op       new time/op       delta
Template          211ms ± 1%        211ms ± 2%    ~     (p=0.832 n=49+49)
Unicode          82.8ms ± 2%       83.2ms ± 2%  +0.44%  (p=0.022 n=46+49)
GoTypes           726ms ± 1%        728ms ± 2%    ~     (p=0.076 n=46+48)
Compiler          3.39s ± 2%        3.40s ± 2%    ~     (p=0.633 n=48+49)
SSA               7.71s ± 1%        7.65s ± 1%  -0.78%  (p=0.000 n=45+44)
Flate             134ms ± 1%        134ms ± 1%    ~     (p=0.195 n=50+49)
GoParser          167ms ± 1%        167ms ± 1%    ~     (p=0.390 n=47+47)
Reflect           453ms ± 3%        452ms ± 2%    ~     (p=0.492 n=48+49)
Tar               184ms ± 3%        184ms ± 2%    ~     (p=0.862 n=50+48)
XML               248ms ± 2%        248ms ± 2%    ~     (p=0.096 n=49+47)
[Geo mean]        415ms             415ms       -0.03%

name        old user-time/op  new user-time/op  delta
Template          273ms ± 1%        273ms ± 2%    ~     (p=0.711 n=48+48)
Unicode           117ms ± 6%        117ms ± 5%    ~     (p=0.633 n=50+50)
GoTypes           972ms ± 2%        974ms ± 1%  +0.29%  (p=0.016 n=47+49)
Compiler          4.46s ± 6%        4.51s ± 6%    ~     (p=0.093 n=50+50)
SSA               10.4s ± 1%        10.3s ± 2%  -0.94%  (p=0.000 n=45+50)
Flate             166ms ± 2%        167ms ± 2%    ~     (p=0.148 n=49+48)
GoParser          202ms ± 1%        202ms ± 2%  -0.28%  (p=0.014 n=47+49)
Reflect           594ms ± 2%        594ms ± 2%    ~     (p=0.717 n=48+49)
Tar               224ms ± 2%        224ms ± 2%    ~     (p=0.805 n=50+49)
XML               311ms ± 1%        310ms ± 1%    ~     (p=0.177 n=49+48)
[Geo mean]        537ms             537ms       +0.01%

Change-Id: I562b9f349b34ddcff01771769e6dbbc80604da7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/221237
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoruntime: deflake CGO traceback tests
Mark Pulford [Thu, 13 Feb 2020 21:34:31 +0000 (08:34 +1100)]
runtime: deflake CGO traceback tests

The CGO traceback function is called whenever CGO code is executing and
a signal is received. This occurs much more frequently now SIGURG
is used for preemption.

Disable signal preemption to significantly increase the likelihood that
a signal results in a profile sample during the test.

Updates #37201

Change-Id: Icb1a33ab0754d1a74882a4ee265b4026abe30bdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/219417
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: add a dark mode to ssa html generation which can be toggled
Bradford Lamson-Scribner [Thu, 20 Feb 2020 16:07:48 +0000 (09:07 -0700)]
cmd/compile: add a dark mode to ssa html generation which can be toggled

add a tag that when clicked, toggles a dark mode. It keeps intact
the grayed out dead values/blocks, all the highlight colors, and ensures
text is always readable.

Fixes #34325

Change-Id: I4af1e4b5f4a5b63e54c992e90f8474cc51c63465
Reviewed-on: https://go-review.googlesource.com/c/go/+/220260
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go, cmd/link: implement -buildmode=pie on windows
Alex Brainman [Tue, 25 Feb 2020 07:42:24 +0000 (18:42 +1100)]
cmd/go, cmd/link: implement -buildmode=pie on windows

This CL implements windows version of -buildmode=pie code in both
cmd/go and cmd/link.

Windows executables built with -buildmode=pie set (unlike the one
built with -buildmode=exe) will have extra .reloc PE section, and
will have no IMAGE_FILE_RELOCS_STRIPPED flag set. They will also
have IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE flag set, and
IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA flag set for windows/amd64.

Both cgo and non-cgo versions are implemented. And TestBuildmodePIE
is extended to test both cgo and non-cgo versions on windows and
linux.

This CL used some code from CLs 152759 and 203602.

RELNOTE=yes

Fixes #27144
Updates #35192

Change-Id: I1249e4ffbd79bd4277efefb56db321c390c0f76f
Reviewed-on: https://go-review.googlesource.com/c/go/+/214397
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotime: optimize Time.ISOWeek
Shuo [Sun, 1 Mar 2020 02:32:32 +0000 (02:32 +0000)]
time: optimize Time.ISOWeek

name       old time/op  new time/op  delta
ISOWeek-4  57.7ns ± 5%  27.9ns ±10%  -51.54%  (p=0.000 n=48+49)

Fixes #37534

Change-Id: Ic4673ced44a4b0190018e87207743ed9500fb1e0
GitHub-Last-Rev: a376c57e83a99f8e8fde297335caa85215e7aead
GitHub-Pull-Request: golang/go#36316
Reviewed-on: https://go-review.googlesource.com/c/go/+/212837
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime/pprof/internal/profile: make error message readable
Ian Lance Taylor [Thu, 27 Feb 2020 19:24:24 +0000 (11:24 -0800)]
runtime/pprof/internal/profile: make error message readable

The error message for an unrecognized type in decodeField was using
string(i) for an int type i. It was recently changed (by  me) to
string(rune(i)), but that just avoided a vet warning without fixing
the problem. This CL fixes the problem by using fmt.Errorf.

We also change the message to "unknown wire type" to match the master
copy of this code in github.com/google/pprof/profile/proto.go.

Updates #32479

Change-Id: Ia91ea6d5edbd7cd946225d1ee96bb7623b52bb44
Reviewed-on: https://go-review.googlesource.com/c/go/+/221384
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agoruntime: don't invoke t.Fatal* in goroutine in TestLibraryCtrlHandler
Emmanuel T Odeke [Sat, 29 Feb 2020 10:32:21 +0000 (02:32 -0800)]
runtime: don't invoke t.Fatal* in goroutine in TestLibraryCtrlHandler

Change-Id: I8bb06c360cab3e5a74b0b0f98bb25cca4741d66d
Reviewed-on: https://go-review.googlesource.com/c/go/+/221605
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agonet/textproto: pass missing argument to fmt.Sprintf
Ian Lance Taylor [Thu, 27 Feb 2020 02:34:25 +0000 (18:34 -0800)]
net/textproto: pass missing argument to fmt.Sprintf

The vet tool didn't catch this because the fmt.Sprintf format argument
was written as an expression.

Fixes #37467

Change-Id: I72c20ba45e3f42c195fa5e68adcdb9837c7d7ad5
Reviewed-on: https://go-review.googlesource.com/c/go/+/221297
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agocmd/compile: lower float to uint conversions on s390x
Ruixin(Peter) Bao [Tue, 26 Nov 2019 15:52:43 +0000 (10:52 -0500)]
cmd/compile: lower float to uint conversions on s390x

Add rules for lowering float <-> unsigned int on s390x.

During compilation,
Cvt64Uto64F rule triggers around 80 times,
Cvt64Fto64U rule triggers around 20 times,
Cvt64Uto32F rule triggers around 5 times.

Change-Id: If4c9d128b9132fce8c0bea9abc09cb43a5df7989
Reviewed-on: https://go-review.googlesource.com/c/go/+/209177
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: add more amd64 constant simplifications
Josh Bleecher Snyder [Fri, 28 Feb 2020 02:56:28 +0000 (18:56 -0800)]
cmd/compile: add more amd64 constant simplifications

More minor optimization opportunities from CL 220499.

Change-Id: Ic4f34c41ed8ab0fce227ac194731c1be12c602db
Reviewed-on: https://go-review.googlesource.com/c/go/+/221608
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: constant fold SSA bool to int conversions
Josh Bleecher Snyder [Sat, 29 Feb 2020 15:07:56 +0000 (07:07 -0800)]
cmd/compile: constant fold SSA bool to int conversions

Shaves off a few instructions here and there.

file                        before   after    Δ       %
go/types.s                  322118   321851   -267    -0.083%
go/internal/gcimporter.s    34937    34909    -28     -0.080%
go/internal/gccgoimporter.s 56493    56474    -19     -0.034%
cmd/compile/internal/ssa.s  3926994  3927177  +183    +0.005%
total                       18862670 18862539 -131    -0.001%

Change-Id: I724f32317b946b5138224808f85709d9c097a247
Reviewed-on: https://go-review.googlesource.com/c/go/+/221428
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: use correct types in phiopt
Josh Bleecher Snyder [Sat, 29 Feb 2020 01:04:16 +0000 (17:04 -0800)]
cmd/compile: use correct types in phiopt

We try to preserve type correctness of generic ops.
phiopt modified a bool to be an int without a conversion.
Add a conversion. There are a few random fluctations in the
generated code as a result, but nothing noteworthy or systematic.

no binary size changes

file                        before   after    Δ       %
math.s                      35966    35961    -5      -0.014%
debug/dwarf.s               108141   108147   +6      +0.006%
crypto/dsa.s                6047     6044     -3      -0.050%
image/png.s                 42882    42885    +3      +0.007%
go/parser.s                 80281    80278    -3      -0.004%
cmd/internal/obj.s          115116   115113   -3      -0.003%
go/types.s                  322130   322118   -12     -0.004%
cmd/internal/obj/arm64.s    151679   151685   +6      +0.004%
go/internal/gccgoimporter.s 56487    56493    +6      +0.011%
cmd/test2json.s             1650     1647     -3      -0.182%
cmd/link/internal/loadelf.s 35442    35443    +1      +0.003%
cmd/go/internal/work.s      305039   305035   -4      -0.001%
cmd/link/internal/ld.s      544835   544834   -1      -0.000%
net/http.s                  558777   558774   -3      -0.001%
cmd/compile/internal/ssa.s  3926551  3926994  +443    +0.011%
cmd/compile/internal/gc.s   1552320  1552321  +1      +0.000%
total                       18862241 18862670 +429    +0.002%

Change-Id: I4289e773be6be534ea3f907d68f614441b8f9b46
Reviewed-on: https://go-review.googlesource.com/c/go/+/221607
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoruntime: do not exit(2) if a Go built DLL receives a signal
martin [Fri, 13 Dec 2019 00:03:04 +0000 (16:03 -0800)]
runtime: do not exit(2) if a Go built DLL receives a signal

Fixes #35965

Change-Id: I172501fc0b29595e59b058f6e30f31efe5f6d1f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/211139
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>