diff options
author | David Chase <drchase@google.com> | 2019-11-08 16:11:29 -0500 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2019-11-08 23:22:06 +0000 |
commit | 11da2b227a71c9c041320e22843047ad9b0ab1a8 (patch) | |
tree | 4c19cff0feded160770e2896461e0bbb82c3d56f /src/runtime/export_test.go | |
parent | 42db1da8e9def3490ed904594ad80e1090bff654 (diff) | |
download | go-11da2b227a71c9c041320e22843047ad9b0ab1a8.tar.gz go-11da2b227a71c9c041320e22843047ad9b0ab1a8.zip |
runtime: copy some functions from math/bits to runtime/internal/sys
CL 201765 activated calls from the runtime to functions in math/bits.
When coverage and race detection were simultaneously enabled,
this caused a crash when the covered+race-checked code in
math/bits was called from the runtime before there was even a P.
PS Win for gdlv in helping sort this out.
TODO - next CL intrinsifies the new functions in
runtime/internal/sys
TODO/Would-be-nice - Ctz64 and TrailingZeros64 are the same
function; 386.s is intrinsified; clean all that up.
Fixes #35461.
Updates #35112.
Change-Id: I750a54dba493130ad3e68a06530ede7687d41e1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/206199
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r-- | src/runtime/export_test.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index ea3f1c1776..d3ebd893cb 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -7,7 +7,6 @@ package runtime import ( - "math/bits" "runtime/internal/atomic" "runtime/internal/sys" "unsafe" @@ -360,7 +359,7 @@ func ReadMemStatsSlow() (base, slow MemStats) { slow.HeapReleased += uint64(pg) * pageSize } for _, p := range allp { - pg := bits.OnesCount64(p.pcache.scav) + pg := sys.OnesCount64(p.pcache.scav) slow.HeapReleased += uint64(pg) * pageSize } @@ -894,7 +893,7 @@ func PageCachePagesLeaked() (leaked uintptr) { // Since we're going past len(allp) we may see nil Ps. // Just ignore them. if p != nil { - leaked += uintptr(bits.OnesCount64(p.pcache.cache)) + leaked += uintptr(sys.OnesCount64(p.pcache.cache)) } } |