aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorArsenySamoylov <samoylov.arseny@gmail.com>2026-01-13 13:06:28 +0300
committerGopher Robot <gobot@golang.org>2026-02-02 13:24:26 -0800
commit62d08234b797806796af0d51051f2e13caa42e2a (patch)
treef37768122ffc5e31fddd6c47548ccf776fd69c92 /src/runtime
parent35abaf75c35adc9b22038885781b8be70a8476e0 (diff)
downloadgo-62d08234b797806796af0d51051f2e13caa42e2a.tar.xz
internal/maps,cmd/compile/internal/walk: replace calls to mapaccess1* with mapaccess2*
mapaccess1* and mapaccess2* functions share the same implementation and differ only in whether the boolean "found" is returned. This change replaces mapaccess1* calls with mapaccess2*. We can do this transparently, since the call site can safely discard the second (boolean) result. Ideally, mapacces1* functions could be removed entirely, but this change keeps them as thin wrappers for compatibility. Fixes #73196 Change-Id: I07c3423d22ed1095ac3666d00e134c2747b2f9c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/736020 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/map.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/map.go b/src/runtime/map.go
index 4a0713cfc4..0b61430441 100644
--- a/src/runtime/map.go
+++ b/src/runtime/map.go
@@ -91,16 +91,16 @@ func mapaccess1(t *abi.MapType, m *maps.Map, key unsafe.Pointer) unsafe.Pointer
func mapaccess2(t *abi.MapType, m *maps.Map, key unsafe.Pointer) (unsafe.Pointer, bool)
func mapaccess1_fat(t *abi.MapType, m *maps.Map, key, zero unsafe.Pointer) unsafe.Pointer {
- e := mapaccess1(t, m, key)
- if e == unsafe.Pointer(&zeroVal[0]) {
+ e, ok := mapaccess2(t, m, key)
+ if !ok {
return zero
}
return e
}
func mapaccess2_fat(t *abi.MapType, m *maps.Map, key, zero unsafe.Pointer) (unsafe.Pointer, bool) {
- e := mapaccess1(t, m, key)
- if e == unsafe.Pointer(&zeroVal[0]) {
+ e, ok := mapaccess2(t, m, key)
+ if !ok {
return zero, false
}
return e, true