aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2021-05-22 21:59:00 -0700
committerKeith Randall <khr@golang.org>2021-05-24 17:43:50 +0000
commita22e3172200d4bdd0afcbbe6564dbb67fea4b03a (patch)
treef01dd9e10b280efcd72a70653c118d47e142998e /src/runtime/export_test.go
parent4356e7e85fcd8f59de6bc1fd1db6e4f01a92f19e (diff)
downloadgo-a22e3172200d4bdd0afcbbe6564dbb67fea4b03a.tar.gz
go-a22e3172200d4bdd0afcbbe6564dbb67fea4b03a.zip
cmd/compile: always include underlying type for map types
This is a different fix for #37716. Should help make the fix for #46283 easier, since we will no longer need to keep compiler-generated hash functions and the runtime hash function in sync. Change-Id: I84cb93144e425dcd03afc552b5fbd0f2d2cc6d39 Reviewed-on: https://go-review.googlesource.com/c/go/+/322150 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r--src/runtime/export_test.go25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index a6fc1e4785..c8d01fbb15 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -1148,31 +1148,6 @@ func SemNwait(addr *uint32) uint32 {
return atomic.Load(&root.nwait)
}
-// MapHashCheck computes the hash of the key k for the map m, twice.
-// Method 1 uses the built-in hasher for the map.
-// Method 2 uses the typehash function (the one used by reflect).
-// Returns the two hash values, which should always be equal.
-func MapHashCheck(m interface{}, k interface{}) (uintptr, uintptr) {
- // Unpack m.
- mt := (*maptype)(unsafe.Pointer(efaceOf(&m)._type))
- mh := (*hmap)(efaceOf(&m).data)
-
- // Unpack k.
- kt := efaceOf(&k)._type
- var p unsafe.Pointer
- if isDirectIface(kt) {
- q := efaceOf(&k).data
- p = unsafe.Pointer(&q)
- } else {
- p = efaceOf(&k).data
- }
-
- // Compute the hash functions.
- x := mt.hasher(noescape(p), uintptr(mh.hash0))
- y := typehash(kt, noescape(p), uintptr(mh.hash0))
- return x, y
-}
-
// mspan wrapper for testing.
//go:notinheap
type MSpan mspan