diff options
| author | Austin Clements <austin@google.com> | 2020-07-22 11:21:36 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2020-08-17 13:20:03 +0000 |
| commit | 7bbd5ca5a6a94f58d33de6b1244248a32dc8cd9c (patch) | |
| tree | ada66d10b1f53fd57340c5b75108582e42810458 /src/runtime/proc.go | |
| parent | dc12d5b0f5e9c1cfec2a8eb6dd7ff3473c36d45c (diff) | |
| download | go-7bbd5ca5a6a94f58d33de6b1244248a32dc8cd9c.tar.xz | |
runtime: replace index and contains with bytealg calls
The runtime has its own implementation of string indexing. To reduce
code duplication and cognitive load, replace this with calls to the
internal/bytealg package. We can't do this on Plan 9 because it needs
string indexing in a note handler (which isn't allowed to use the
optimized bytealg version because it uses SSE), so we can't just
eliminate the index function, but this CL does down-scope it so make
it clear it's only for note handlers on Plan 9.
Change-Id: Ie1a142678262048515c481e8c26313b80c5875df
Reviewed-on: https://go-review.googlesource.com/c/go/+/244537
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/proc.go')
| -rw-r--r-- | src/runtime/proc.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 035822216d..ed7e2128ae 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -5,6 +5,7 @@ package runtime import ( + "internal/bytealg" "internal/cpu" "runtime/internal/atomic" "runtime/internal/sys" @@ -5460,7 +5461,7 @@ func haveexperiment(name string) bool { x := sys.Goexperiment for x != "" { xname := "" - i := index(x, ",") + i := bytealg.IndexByteString(x, ',') if i < 0 { xname, x = x, "" } else { |
