aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/type.go
diff options
context:
space:
mode:
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))