1
0
mirror of https://github.com/golang/go synced 2024-11-23 14:50:07 -07:00
Commit Graph

42881 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
74bc90a9a8 cmd/compile: rename a local variable in shortcircuitBlock
v is pretty generic. Subsequent changes will make this function
more complicated, so rename it now, independently, for easier review.

v is the control value for the block (or its underlying phi);
call it ctl.

Passes toolstash-check.

Updates #37608

Change-Id: I3fbae3344f1c95aff0a69c1e4f61ef637a54774e
Reviewed-on: https://go-review.googlesource.com/c/go/+/222917
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-13 19:41:40 +00:00
Russ Cox
be72e3c3ff misc/spectre: add spectre index test
Test for CL 222660.

Change-Id: I1dae41a9746dfc4144a0d29c02201de8ecd216fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/222978
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-13 19:06:00 +00:00
Russ Cox
fc8a6336d1 cmd/asm, cmd/compile, runtime: add -spectre=ret mode
This commit extends the -spectre flag to cmd/asm and adds
a new Spectre mitigation mode "ret", which enables the use
of retpolines.

Retpolines prevent speculation about the target of an indirect
jump or call and are described in more detail here:
https://support.google.com/faqs/answer/7625886

Change-Id: I4f2cb982fa94e44d91e49bd98974fd125619c93a
Reviewed-on: https://go-review.googlesource.com/c/go/+/222661
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-13 19:05:54 +00:00
Russ Cox
877ef86bec cmd/compile: add spectre mitigation mode enabled by -spectre
This commit adds a new cmd/compile flag -spectre,
which accepts a comma-separated list of possible
Spectre mitigations to apply, or the empty string (none),
or "all". The only known mitigation right now is "index",
which uses conditional moves to ensure that x86-64 CPUs
do not speculate past index bounds checks.

Speculating past index bounds checks may be problematic
on systems running privileged servers that accept requests
from untrusted users who can execute their own programs
on the same machine. (And some more constraints that
make it even more unlikely in practice.)

The cases this protects against are analogous to the ones
Microsoft explains in the "Array out of bounds load/store feeding ..."
sections here:
https://docs.microsoft.com/en-us/cpp/security/developer-guidance-speculative-execution?view=vs-2019#array-out-of-bounds-load-feeding-an-indirect-branch

Change-Id: Ib7532d7e12466b17e04c4e2075c2a456dc98f610
Reviewed-on: https://go-review.googlesource.com/c/go/+/222660
Reviewed-by: Keith Randall <khr@golang.org>
2020-03-13 19:05:46 +00:00
Keith Randall
d84cbec890 cmd/compile: convert 386 port to use addressing modes pass
Update #36468

Change-Id: Idfdb845d097994689be450d6e8a57fa9adb57166
Reviewed-on: https://go-review.googlesource.com/c/go/+/222782
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2020-03-13 17:00:54 +00:00
zikaeroh
c3b9042132 cmd/cover: skip function declarations with blank names
Function declarations with blank ("_") names do not introduce a binding,
and therefore cannot be referenced or executed (in fact, they do not
make it into the final compiled binary at all). As such, counters
defined while annotating their bodies will always be zero.

These types of functions are commonly used to create compile-time
checks (e.g., stringer) which are not expected to be executed.

Skip over these functions when annotating a file, preventing the unused
counters from being generated and appearing as uncovered lines in
coverage reports.

Fixes #36264

Change-Id: I6b516cf43c430a6248d68d5f483a3902253fbdab
Reviewed-on: https://go-review.googlesource.com/c/go/+/223117
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-13 14:29:27 +00:00
zikaeroh
c6bcdeafd2 cmd/go: check for 'svn' binary in PATH in TestAccidentalGitCheckout
This test requires subversion to run, but does not check to see if it's
available before running as it does for git.

Call testenv.MustHaveExecPath to check beforehand to allow the test to
be skipped if the svn binary does not exist.

Change-Id: I16ae104621b221fc6e96f6c7dcd71bf406caa0c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/223082
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-13 13:52:49 +00:00
Lynn Boger
9d67a94217 cmd/internal/obj/ppc64: clean up some opcodes
This does some clean up of the ppc64 opcodes to remove names
from the opcode list that don't actually assemble. At one time
names were added to this list to represent opcode "classes" to
organize other opcodes that have the same set of operand
combinations. Since this is not documented, it is confusing as
to which opcodes can be used in an asm file and which can't, and
which opcodes should be supported in the disassembler. It is
clearer for the user if the list of Go opcodes are all opcodes
that can be assembled with names that match the ppc64 opcode
where possible.

I found this when trying to use Go opcode XXLAND in an asm file
which seems like it should map to ppc64 xxland but when used it
gets this error:

go tool asm test_xxland.s
asm: bad r/r, r/r/r or r/r/r/r opcode XXLAND
asm: assembly failed

This change removes the opcodes that are only used for opcode
"classes" and fixes the case statement where they are referenced.
This also fixes XXLAND and XXPERM which are opcodes that should
assemble to their corresponding ppc64 opcode but do not.

Change-Id: I52300db6b22f7f8b3dd3491c3f35a384b943352c
Reviewed-on: https://go-review.googlesource.com/c/go/+/223138
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-13 11:41:22 +00:00
Ian Lance Taylor
85e87f9d81 time: stop referring to timerproc in comment
The timerproc function has been removed.

Fixes #37774

Change-Id: Ice5e1d8fec91cd6ee7f032e0d21e8315a26bc6a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/222783
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
2020-03-13 00:19:08 +00:00
Johan Jansson
1f231d74f6 runtime: emit more specific errors from checkptr
Update error messages for pointer alignment checks and pointer
arithmetic checks so that each type of error has a unique error
message.

Fixes #37488

Change-Id: Ida2c2fa3f041a3307d665879a463f9e8f2c1fd03
Reviewed-on: https://go-review.googlesource.com/c/go/+/223037
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-12 23:45:51 +00:00
Ian Lance Taylor
5d70cb0667 runtime: leave cleantimers early if G is being preempted
The cleantimers can run for a while in some unlikely cases.
If the GC is trying to preempt the G, it is forced to wait as the
G is holding timersLock. To avoid introducing a GC delay,
return from cleantimers if the G has a preemption request.

Fixes #37779

Change-Id: Id9a567f991e26668e2292eefc39e2edc56efa4e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/223122
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-12 23:17:02 +00:00
David Chase
29b36a88ab cmd/objdump: guard against out-of-range lines from directives.
//line bogo.go:9999999 will cause 'go tool objdump' to crash
unless bogo.go has that many lines.  Guard the array index
and return innocuous values (nil, nil) from the file cache.

Fixes #36683

Change-Id: I4a9f8444dc611654d270cc876e8848dfd2f84770
Reviewed-on: https://go-review.googlesource.com/c/go/+/223081
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-12 20:40:54 +00:00
Walt Della
e221a75dea cmd/go: improve pseudo-version timestamp error
The previous "invalid pseudo-version: does not match version-control
timestamp" error message used a different timestamp format than the
format used in go.mod and go.sum. For cut-and-paste-ability this patch
makes the two consistent.

Fixes #36974

Change-Id: I21f344ab9898cc584c0bcf4a75d74275a703c650
Reviewed-on: https://go-review.googlesource.com/c/go/+/217437
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-03-12 20:00:02 +00:00
Bryan C. Mills
c4113b64c2 cmd/go: fix test failures with -count=2
In each test, either set the -n flag to avoid writing build artifacts
to the cache, or set GOCACHE explicitly to point to a clean cache.

Tested manually with 'go test -count=2 cmd/go'.

Fixes #37820

Change-Id: I24403e738b1a10d5fe9dc8d98ef27a76ebe2704a
Reviewed-on: https://go-review.googlesource.com/c/go/+/223140
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-12 17:46:03 +00:00
David Chase
040855e39b test: restore no-gogcflags build shortcut, save time
With a clean cache on a laptop
before change
time go run run.go -- . fixedbugs
  real	2m10.195s
  user	3m16.547s
  sys	1m52.939s

Or, before, directly after make.bash (the actual use case we care about)
time go run run.go -- . fixedbugs
  real	2m8.704s
  user	3m12.327s
  sys	1m49.123s

after change
time go run run.go -- . fixedbugs
  real	1m38.915s
  user	2m38.389s
  sys	1m8.490s

Tests, fortunately, still seem to pass.

Latest version of this takes the slow route for cross-compilation, which includes wasm.

Change-Id: Iad19951612defa96c4e9830bce920c5e8733834a
Reviewed-on: https://go-review.googlesource.com/c/go/+/223083
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-12 17:37:13 +00:00
Bryan C. Mills
938ad552cd cmd/go: add missing newline to "go" line in cache key
This was missed in CL 223139. It doesn't seem to affect correctness,
but might be confusing if we need to debug the cache key.

Updates #37804

Change-Id: I979efa68381cf79a7e246581510c90a724be6cd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/223144
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-12 15:06:36 +00:00
Bryan C. Mills
c95708462f cmd/go: include the go language version in cache keys
Fixes #37804

Change-Id: I4381dc5c58cfd467506d3d73fbd19c2c7257338e
Reviewed-on: https://go-review.googlesource.com/c/go/+/223139
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-03-12 14:07:16 +00:00
David Howden
139a79dc37 cmd/go/internal/auth: fix .netrc lookup for URLs with specified port
The .netrc spec [1] defines credentials based on "machine name", so remove specified ports
from URL before looking for a match.

[1] https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html

Fixes #37130

Change-Id: Iab993afba26c927454d6166111ad1e1a53dbce43
Reviewed-on: https://go-review.googlesource.com/c/go/+/218418
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-12 12:58:31 +00:00
Rob Pike
65bd07611c io: add a comment about how to turn a Reader into ByteReader
Offered as an alternative to CL 221380, which was more
tutorial than necessary.

Update #37344

Change-Id: Ide673b0b97983c2c2319a9311dc3d0a10567e6c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/223097
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-12 01:31:41 +00:00
Than McIntosh
67d93cfd35 cmd/internal/objabi: rerun stringer for sym kind
Regenerate symkind_string.go, since it has become a bit out of date.

Change-Id: I57abf67aab8fe4e4a94fb5e45b9bc4c4005cbae3
Reviewed-on: https://go-review.googlesource.com/c/go/+/223079
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-11 22:32:55 +00:00
Tamir Duberstein
251f3e5b9c runtime/pprof: document that debug=0 emits proto
Updates #16093.

Change-Id: I629b3d44d6b2083f5e62701cc0c23fe2362502d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/222676
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-03-11 22:12:58 +00:00
Cuong Manh Le
235a7c57be cmd/compile: remove guard for OCOMPLEX in evconst
After CL 166983, the guard for OCOMPLEX in evconst is not necessary
anymore.

Passes toolstash-check.

Change-Id: I1d4a9b447bad9ba0289fc7f997febc0e0b4167ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/214837
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-03-11 20:17:30 +00:00
Filippo Valsorda
efc832b8de crypto/tls: add {SignatureScheme,CurveID,ClientAuthType}.String()
Fixes #35499

Change-Id: Ieb487782f389f6d80e8f68ee980e584d906cb4da
Reviewed-on: https://go-review.googlesource.com/c/go/+/208226
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-03-11 20:02:18 +00:00
Robert Griesemer
f6a0d72385 cmd/compile/internal/syntax: various cleanups following CL 221603
1) Introduced setLit method to uniformly set the scanner state for
   literals instead of directly manipulating the scanner fields.

2) Use a local variable 'ok' to track validity of literals instead
   of relying on the side-effect of error reporters setting s.bad.
   More code but clearer because it is local and explicit.

3) s/litname/baseName/ and use this function uniformly, also for
   escapes. Consequently we now report always "hexadecimal" and
   not "hex" (in the case of invalid escapes).

4) Added TestDirectives verifying that we get the correct directive
   string (even if that string contains '%').

Verified that lines/s parsing performance is unchanged by comparing

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

before and after (no relevant difference).

Change-Id: I143e4648fdaa31d1c365fb794a1cae4bc1c3f5ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/222258
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-03-11 19:59:39 +00:00
Bryan C. Mills
eafb4d8f8f cmd/internal/moddeps: set GO111MODULE explicitly for moddeps_test 'go' commands
This fixes observed failures using the following steps to reproduce:

	go env -w GO111MODULE=off
	go test cmd/internal/moddeps

Fixes #37749

Change-Id: I7761f0b20266ac911ad19a724ba2551beca3f267
Reviewed-on: https://go-review.googlesource.com/c/go/+/222674
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>
2020-03-11 18:47:13 +00:00
Jay Conrod
576fa69277 cmd/go: extract module zip files in place
Previously, we extracted module zip files to temporary directories
with random names, then renamed them to their final locations. This
failed with ERROR_ACCESS_DENIED on Windows if any file in the
temporary was open. Antivirus programs did this occasionally. Retrying
the rename did not work (CL 220978).

With this change, we extract module zip files in place. We create a
.partial file alongside the .lock file to indicate a directory is not
fully populated, and we delete this at the end of the process.

Updates #36568

Change-Id: I75c09df879a602841f3459322c021896292b2fdb
Reviewed-on: https://go-review.googlesource.com/c/go/+/221157
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-03-11 17:31:14 +00:00
Jay Conrod
093049b370 cmd/go: make module zip extraction more robust
Currently, we extract module zip files to temporary directories, then
atomically rename them into place. On Windows, this can fail with
ERROR_ACCESS_DENIED if another process (antivirus) has files open
before the rename. In CL 220978, we repeated the rename operation in a
loop over 500 ms, but this didn't solve the problem for everyone.

A better solution will extract module zip files to their permanent
locations in the cache and will keep a ".partial" marker file,
indicating when a module hasn't been fully extracted (CL 221157).
This approach is not safe if current versions of Go access the module
cache concurrently, since the module directory is detected with a
single os.Stat.

In the interim, this CL makes two changes:

1. Flaky file system operations are repeated over 2000 ms to reduce
the chance of this error occurring.
2. cmd/go will now check for .partial files created by future
versions. If a .partial file is found, it will lock the lock file,
then remove the .partial file and directory if needed.

After some time has passed and Go versions lacking this CL are no
longer supported, we can start extracting module zip files in place.

Updates #36568

Change-Id: I467ee11aa59a90b63cf0e3e761c4fec89d57d3b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/221820
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-11 17:31:00 +00:00
Bryan C. Mills
cf82feabb6 net: use t.Deadline instead of an arbitrary read deadline in TestDialParallelSpuriousConnection
Also increase the default deadline to 5s, since it empirically
doesn't need to be short and 1s seems to be too slow on some platforms.

Fixes #37795

Change-Id: Ie6bf3916b107401235a1fa8cb0f22c4a98eb2dae
Reviewed-on: https://go-review.googlesource.com/c/go/+/222959
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-03-11 16:49:13 +00:00
Josh Bleecher Snyder
211ee9f07c 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>
2020-03-11 16:29:44 +00:00
Russ Cox
b136f0c17b 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>
2020-03-11 16:17:24 +00:00
Russ Cox
96dc04412d 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>
2020-03-11 16:17:18 +00:00
Russ Cox
801a9d9a0c 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>
2020-03-11 16:17:08 +00:00
Bryan C. Mills
0e3ace42f5 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>
2020-03-11 15:55:54 +00:00
Bryan C. Mills
035c018d40 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>
2020-03-11 15:05:56 +00:00
Josh Bleecher Snyder
c6fef1fb52 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>
2020-03-11 11:47:34 +00:00
Cuong Manh Le
6bed304244 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>
2020-03-11 06:06:20 +00:00
erifan01
3af92acb9f 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>
2020-03-11 05:13:13 +00:00
Dan Scales
fae87a2223 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>
2020-03-10 21:35:37 +00:00
Than McIntosh
5db3c8f1fd 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>
2020-03-10 19:41:44 +00:00
Bryan C. Mills
c6f678b6ef 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>
2020-03-10 17:41:14 +00:00
Keith Randall
2b8e60d464 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>
2020-03-10 16:26:59 +00:00
Joel Sing
9f74f0afa6 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>
2020-03-10 16:25:09 +00:00
Alex Brainman
da07c59f24 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>
2020-03-10 08:18:53 +00:00
Ian Lance Taylor
38ad3baf00 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>
2020-03-10 04:53:34 +00:00
Nathan Fiscaletti
92d1fb7cb4 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: 220959beba
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>
2020-03-10 00:47:23 +00:00
smasher164
a79ac2b819 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>
2020-03-10 00:47:00 +00:00
smasher164
08dee51e59 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>
2020-03-10 00:24:30 +00:00
Keith Randall
98cb76799c 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>
2020-03-10 00:13:21 +00:00
smasher164
d49fecc474 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>
2020-03-09 20:45:44 +00:00
Josh Bleecher Snyder
5fac45a320 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>
2020-03-09 20:19:25 +00:00