aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/type.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2024-04-19 13:52:31 -0400
committerGopher Robot <gobot@golang.org>2024-08-02 16:41:53 +0000
commit4f7dc282c4bdfba4e63b39bbe9846c1469dc7ee5 (patch)
treeb4fa4f7de70120c25c408b85056ac30245cfaef9 /src/runtime/type.go
parent057b703407fa833193cbdc1f37179561c6c9da90 (diff)
downloadgo-4f7dc282c4bdfba4e63b39bbe9846c1469dc7ee5.tar.xz
all: split old and swiss map abi and compiler integration
The two map implementations are still identical, but now the compiler targets the appropriate ABI depending on GOEXPERIMENT. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-swissmap Change-Id: I8438f64f044ba9de30ddbf2b8ceb9b4edd2d5614 Reviewed-on: https://go-review.googlesource.com/c/go/+/580779 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/type.go')
-rw-r--r--src/runtime/type.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/runtime/type.go b/src/runtime/type.go
index 201340752b..5e5c99276c 100644
--- a/src/runtime/type.go
+++ b/src/runtime/type.go
@@ -8,6 +8,7 @@ package runtime
import (
"internal/abi"
+ "internal/goexperiment"
"unsafe"
)
@@ -235,8 +236,6 @@ type uncommontype = abi.UncommonType
type interfacetype = abi.InterfaceType
-type maptype = abi.MapType
-
type arraytype = abi.ArrayType
type chantype = abi.ChanType
@@ -439,8 +438,13 @@ func typesEqual(t, v *_type, seen map[_typePair]struct{}) bool {
}
return true
case abi.Map:
- mt := (*maptype)(unsafe.Pointer(t))
- mv := (*maptype)(unsafe.Pointer(v))
+ if goexperiment.SwissMap {
+ mt := (*abi.SwissMapType)(unsafe.Pointer(t))
+ mv := (*abi.SwissMapType)(unsafe.Pointer(v))
+ return typesEqual(mt.Key, mv.Key, seen) && typesEqual(mt.Elem, mv.Elem, seen)
+ }
+ mt := (*abi.OldMapType)(unsafe.Pointer(t))
+ mv := (*abi.OldMapType)(unsafe.Pointer(v))
return typesEqual(mt.Key, mv.Key, seen) && typesEqual(mt.Elem, mv.Elem, seen)
case abi.Pointer:
pt := (*ptrtype)(unsafe.Pointer(t))