]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: use memhash from package runtime
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 30 Sep 2022 04:51:48 +0000 (11:51 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Sat, 4 Feb 2023 07:02:52 +0000 (07:02 +0000)
Simplify the code, and prevent creating ONAME node with nil Func.

Passes toolstash-check.

Change-Id: I5e5be660510dc0ef5521d278c6b9214a80b994eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/436958
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/cmd/compile/internal/reflectdata/alg.go
src/cmd/compile/internal/typecheck/_builtin/runtime.go
src/cmd/compile/internal/typecheck/builtin.go

index 4577e9cfc4acf5e0ea385d1236b7dda9df5d283a..4f174a3bb81243dbbb3472780eebeb1322955133 100644 (file)
@@ -595,17 +595,7 @@ func anyCall(fn *ir.Func) bool {
 }
 
 func hashmem(t *types.Type) ir.Node {
-       sym := ir.Pkgs.Runtime.Lookup("memhash")
-
-       // TODO(austin): This creates an ir.Name with a nil Func.
-       n := typecheck.NewName(sym)
-       ir.MarkFunc(n)
-       n.SetType(types.NewSignature(nil, []*types.Field{
-               types.NewField(base.Pos, nil, types.NewPtr(t)),
-               types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
-               types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
-       }, []*types.Field{
-               types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]),
-       }))
+       n := typecheck.LookupRuntime("memhash")
+       n = typecheck.SubstArgTypes(n, t)
        return n
 }
index 69c456a557aa79f671adf6f159305ec472d3544a..3b32044756bf439d8ee89be5521aa3d164ec5d57 100644 (file)
@@ -207,7 +207,7 @@ func strequal(p, q unsafe.Pointer) bool
 func interequal(p, q unsafe.Pointer) bool
 func nilinterequal(p, q unsafe.Pointer) bool
 
-func memhash(p unsafe.Pointer, h uintptr, size uintptr) uintptr
+func memhash(x *any, h uintptr, size uintptr) uintptr
 func memhash0(p unsafe.Pointer, h uintptr) uintptr
 func memhash8(p unsafe.Pointer, h uintptr) uintptr
 func memhash16(p unsafe.Pointer, h uintptr) uintptr
index 6aa5e391fc06c25b3675c80ee90dd73af2735746..9be354e38db9f07a14234cc497318e43f4fe1e39 100644 (file)
@@ -361,7 +361,7 @@ func runtimeTypes() []*types.Type {
        typs[123] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6]))
        typs[124] = newSig(params(typs[3], typs[3]), params(typs[6]))
        typs[125] = newSig(params(typs[7], typs[7]), params(typs[6]))
-       typs[126] = newSig(params(typs[7], typs[5], typs[5]), params(typs[5]))
+       typs[126] = newSig(params(typs[3], typs[5], typs[5]), params(typs[5]))
        typs[127] = newSig(params(typs[7], typs[5]), params(typs[5]))
        typs[128] = newSig(params(typs[22], typs[22]), params(typs[22]))
        typs[129] = newSig(params(typs[24], typs[24]), params(typs[24]))