aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/alg.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2023-01-20 16:41:57 -0500
committerDavid Chase <drchase@google.com>2023-05-05 14:59:28 +0000
commitbdc6ae579aa86d21183c612c8c37916f397afaa8 (patch)
treecc63ff843ab5a7f3c196c8fa2c74924bfee61d93 /src/runtime/alg.go
parentdace96b9a12905b34af609eedaa6b43e30e7cdb1 (diff)
downloadgo-bdc6ae579aa86d21183c612c8c37916f397afaa8.tar.xz
internal/abi: refactor (basic) type struct into one definition
This touches a lot of files, which is bad, but it is also good, since there's N copies of this information commoned into 1. The new files in internal/abi are copied from the end of the stack; ultimately this will all end up being used. Change-Id: Ia252c0055aaa72ca569411ef9f9e96e3d610889e Reviewed-on: https://go-review.googlesource.com/c/go/+/462995 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/alg.go')
-rw-r--r--src/runtime/alg.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go
index 2a413eeef3..3e30e7ca77 100644
--- a/src/runtime/alg.go
+++ b/src/runtime/alg.go
@@ -5,6 +5,7 @@
package runtime
import (
+ "internal/abi"
"internal/cpu"
"internal/goarch"
"unsafe"
@@ -100,7 +101,7 @@ func interhash(p unsafe.Pointer, h uintptr) uintptr {
return h
}
t := tab._type
- if t.equal == nil {
+ if t.Equal == nil {
// Check hashability here. We could do this check inside
// typehash, but we want to report the topmost type in
// the error text (e.g. in a struct with a field of slice type
@@ -120,7 +121,7 @@ func nilinterhash(p unsafe.Pointer, h uintptr) uintptr {
if t == nil {
return h
}
- if t.equal == nil {
+ if t.Equal == nil {
// See comment in interhash above.
panic(errorString("hash of unhashable type " + t.string()))
}
@@ -142,18 +143,18 @@ func nilinterhash(p unsafe.Pointer, h uintptr) uintptr {
// 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 {
+ if t.TFlag&abi.TFlagRegularMemory != 0 {
// Handle ptr sizes specially, see issue 37086.
- switch t.size {
+ switch t.Size_ {
case 4:
return memhash32(p, h)
case 8:
return memhash64(p, h)
default:
- return memhash(p, h, t.size)
+ return memhash(p, h, t.Size_)
}
}
- switch t.kind & kindMask {
+ switch t.Kind_ & kindMask {
case kindFloat32:
return f32hash(p, h)
case kindFloat64:
@@ -173,7 +174,7 @@ func typehash(t *_type, p unsafe.Pointer, h uintptr) uintptr {
case kindArray:
a := (*arraytype)(unsafe.Pointer(t))
for i := uintptr(0); i < a.len; i++ {
- h = typehash(a.elem, add(p, i*a.elem.size), h)
+ h = typehash(a.elem, add(p, i*a.elem.Size_), h)
}
return h
case kindStruct:
@@ -244,7 +245,7 @@ func efaceeq(t *_type, x, y unsafe.Pointer) bool {
if t == nil {
return true
}
- eq := t.equal
+ eq := t.Equal
if eq == nil {
panic(errorString("comparing uncomparable type " + t.string()))
}
@@ -261,7 +262,7 @@ func ifaceeq(tab *itab, x, y unsafe.Pointer) bool {
return true
}
t := tab._type
- eq := t.equal
+ eq := t.Equal
if eq == nil {
panic(errorString("comparing uncomparable type " + t.string()))
}