From 62d08234b797806796af0d51051f2e13caa42e2a Mon Sep 17 00:00:00 2001 From: ArsenySamoylov Date: Tue, 13 Jan 2026 13:06:28 +0300 Subject: 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 Reviewed-by: Michael Pratt Auto-Submit: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall --- src/runtime/map.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/runtime') 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 -- cgit v1.3-5-g9baa