aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/map_fast32.go
diff options
context:
space:
mode:
authorPouriya <pouriya.jahanbakhsh@gmail.com>2024-02-27 21:51:31 +0000
committerGopher Robot <gobot@golang.org>2024-03-04 17:34:30 +0000
commit4c08c125936b4ae3daff04cecf5309dd5dd1e2c5 (patch)
treefac8b4deb533caf5caaf89b0c12ab777d2c07f39 /src/runtime/map_fast32.go
parent566e08fc649cb8c65d2a9f0f362ce76d79e0fc4d (diff)
downloadgo-4c08c125936b4ae3daff04cecf5309dd5dd1e2c5.tar.xz
runtime: use .Pointers() instead of manual checking
Change-Id: Ib78c1513616089f4942297cd17212b1b11871fd5 GitHub-Last-Rev: f97fe5b5bffffe25dc31de7964588640cb70ec41 GitHub-Pull-Request: golang/go#65819 Reviewed-on: https://go-review.googlesource.com/c/go/+/565515 Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/map_fast32.go')
-rw-r--r--src/runtime/map_fast32.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/runtime/map_fast32.go b/src/runtime/map_fast32.go
index 3290321782..01a81439e3 100644
--- a/src/runtime/map_fast32.go
+++ b/src/runtime/map_fast32.go
@@ -302,13 +302,13 @@ search:
// Only clear key if there are pointers in it.
// This can only happen if pointers are 32 bit
// wide as 64 bit pointers do not fit into a 32 bit key.
- if goarch.PtrSize == 4 && t.Key.PtrBytes != 0 {
+ if goarch.PtrSize == 4 && t.Key.Pointers() {
// The key must be a pointer as we checked pointers are
// 32 bits wide and the key is 32 bits wide also.
*(*unsafe.Pointer)(k) = nil
}
- e := add(unsafe.Pointer(b), dataOffset+abi.MapBucketCount*4+i*uintptr(t.ValueSize))
- if t.Elem.PtrBytes != 0 {
+ e := add(unsafe.Pointer(b), dataOffset+abi.MapBucketCount*4+i*uintptr(t.ValueSize))
+ if t.Elem.Pointers() {
memclrHasPointers(e, t.Elem.Size_)
} else {
memclrNoHeapPointers(e, t.Elem.Size_)
@@ -428,7 +428,7 @@ func evacuate_fast32(t *maptype, h *hmap, oldbucket uintptr) {
dst.b.tophash[dst.i&(abi.MapBucketCount-1)] = top // mask dst.i as an optimization, to avoid a bounds check
// Copy key.
- if goarch.PtrSize == 4 && t.Key.PtrBytes != 0 && writeBarrier.enabled {
+ if goarch.PtrSize == 4 && t.Key.Pointers() && writeBarrier.enabled {
// Write with a write barrier.
*(*unsafe.Pointer)(dst.k) = *(*unsafe.Pointer)(k)
} else {
@@ -446,7 +446,7 @@ func evacuate_fast32(t *maptype, h *hmap, oldbucket uintptr) {
}
}
// Unlink the overflow buckets & clear key/elem to help GC.
- if h.flags&oldIterator == 0 && t.Bucket.PtrBytes != 0 {
+ if h.flags&oldIterator == 0 && t.Bucket.Pointers() {
b := add(h.oldbuckets, oldbucket*uintptr(t.BucketSize))
// Preserve b.tophash because the evacuation
// state is maintained there.