aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/alg.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/alg.go')
-rw-r--r--src/runtime/alg.go68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/runtime/alg.go b/src/runtime/alg.go
index 4626899aaf..df32bc7941 100644
--- a/src/runtime/alg.go
+++ b/src/runtime/alg.go
@@ -250,74 +250,6 @@ func typehash(t *_type, p unsafe.Pointer, h uintptr) uintptr {
}
}
-func mapKeyError(t *maptype, p unsafe.Pointer) error {
- if !t.HashMightPanic() {
- return nil
- }
- return mapKeyError2(t.Key, p)
-}
-
-func mapKeyError2(t *_type, p unsafe.Pointer) error {
- if t.TFlag&abi.TFlagRegularMemory != 0 {
- return nil
- }
- switch t.Kind_ & abi.KindMask {
- case abi.Float32, abi.Float64, abi.Complex64, abi.Complex128, abi.String:
- return nil
- case abi.Interface:
- i := (*interfacetype)(unsafe.Pointer(t))
- var t *_type
- var pdata *unsafe.Pointer
- if len(i.Methods) == 0 {
- a := (*eface)(p)
- t = a._type
- if t == nil {
- return nil
- }
- pdata = &a.data
- } else {
- a := (*iface)(p)
- if a.tab == nil {
- return nil
- }
- t = a.tab.Type
- pdata = &a.data
- }
-
- if t.Equal == nil {
- return errorString("hash of unhashable type " + toRType(t).string())
- }
-
- if isDirectIface(t) {
- return mapKeyError2(t, unsafe.Pointer(pdata))
- } else {
- return mapKeyError2(t, *pdata)
- }
- case abi.Array:
- a := (*arraytype)(unsafe.Pointer(t))
- for i := uintptr(0); i < a.Len; i++ {
- if err := mapKeyError2(a.Elem, add(p, i*a.Elem.Size_)); err != nil {
- return err
- }
- }
- return nil
- case abi.Struct:
- s := (*structtype)(unsafe.Pointer(t))
- for _, f := range s.Fields {
- if f.Name.IsBlank() {
- continue
- }
- if err := mapKeyError2(f.Typ, add(p, f.Offset)); err != nil {
- return err
- }
- }
- return nil
- default:
- // Should never happen, keep this case for robustness.
- return errorString("hash of unhashable type " + toRType(t).string())
- }
-}
-
//go:linkname reflect_typehash reflect.typehash
func reflect_typehash(t *_type, p unsafe.Pointer, h uintptr) uintptr {
return typehash(t, p, h)