aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/alg.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/alg.go
parent4356e7e85fcd8f59de6bc1fd1db6e4f01a92f19e (diff)
downloadgo-a22e3172200d4bdd0afcbbe6564dbb67fea4b03a.tar.xz
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/alg.go')
-rw-r--r--src/runtime/alg.go19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go
index 1b3bf1180d..39c7426842 100644
--- a/src/runtime/alg.go
+++ b/src/runtime/alg.go
@@ -178,28 +178,11 @@ func typehash(t *_type, p unsafe.Pointer, h uintptr) uintptr {
return h
case kindStruct:
s := (*structtype)(unsafe.Pointer(t))
- memStart := uintptr(0)
- memEnd := uintptr(0)
for _, f := range s.fields {
- if memEnd > memStart && (f.name.isBlank() || f.offset() != memEnd || f.typ.tflag&tflagRegularMemory == 0) {
- // flush any pending regular memory hashing
- h = memhash(add(p, memStart), h, memEnd-memStart)
- memStart = memEnd
- }
if f.name.isBlank() {
continue
}
- if f.typ.tflag&tflagRegularMemory == 0 {
- h = typehash(f.typ, add(p, f.offset()), h)
- continue
- }
- if memStart == memEnd {
- memStart = f.offset()
- }
- memEnd = f.offset() + f.typ.size
- }
- if memEnd > memStart {
- h = memhash(add(p, memStart), h, memEnd-memStart)
+ h = typehash(f.typ, add(p, f.offset()), h)
}
return h
default: