aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/alg.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/alg.go')
-rw-r--r--libgo/go/runtime/alg.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/libgo/go/runtime/alg.go b/libgo/go/runtime/alg.go
index 101402c..95f02aa 100644
--- a/libgo/go/runtime/alg.go
+++ b/libgo/go/runtime/alg.go
@@ -176,9 +176,19 @@ func nilinterhash(p unsafe.Pointer, h uintptr) uintptr {
// is slower but more general and is used for hashing interface types
// (called from interhash or nilinterhash, above) or for hashing in
// maps generated by reflect.MapOf (reflect_typehash, below).
+// Note: this function must match the compiler generated
+// functions exactly. See issue 37716.
func typehash(t *_type, p unsafe.Pointer, h uintptr) uintptr {
if t.tflag&tflagRegularMemory != 0 {
- return memhash(p, h, t.size)
+ // Handle ptr sizes specially, see issue 37086.
+ switch t.size {
+ case 4:
+ return memhash32(p, h)
+ case 8:
+ return memhash64(p, h)
+ default:
+ return memhash(p, h, t.size)
+ }
}
switch t.kind & kindMask {
case kindFloat32: