diff options
author | Dan Scales <danscales@google.com> | 2021-01-27 12:55:57 -0800 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-01-28 20:28:11 +0000 |
commit | 2440dd457a451084e4a23b1b0903953f331abea7 (patch) | |
tree | a0e842ba46d323821e2af3515485674bebe0b5f0 /src/cmd/compile/internal/reflectdata/alg.go | |
parent | c0bf904ddf89b549a4a9d91a634fea1422744c33 (diff) | |
download | go-2440dd457a451084e4a23b1b0903953f331abea7.tar.gz go-2440dd457a451084e4a23b1b0903953f331abea7.zip |
[dev.typeparams] cmd/compile: start adding info needed for typeparams in types & ir
We are focusing on generic functions first, and ignoring type lists for
now.
The signatures of types.NewSignature() and ir.NewCallExpr() changed (with
addition of type args/params).
Change-Id: I57480be3d1f65690b2946e15dd74929bf42873f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/287416
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata/alg.go')
-rw-r--r-- | src/cmd/compile/internal/reflectdata/alg.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cmd/compile/internal/reflectdata/alg.go b/src/cmd/compile/internal/reflectdata/alg.go index fcd824f164..3d8729069a 100644 --- a/src/cmd/compile/internal/reflectdata/alg.go +++ b/src/cmd/compile/internal/reflectdata/alg.go @@ -176,7 +176,7 @@ func genhash(t *types.Type) *obj.LSym { loop.PtrInit().Append(init) // h = hashel(&p[i], h) - call := ir.NewCallExpr(base.Pos, ir.OCALL, hashel, nil) + call := ir.NewCallExpr(base.Pos, ir.OCALL, hashel, nil, nil) nx := ir.NewIndexExpr(base.Pos, np, ni) nx.SetBounded(true) @@ -202,7 +202,7 @@ func genhash(t *types.Type) *obj.LSym { // Hash non-memory fields with appropriate hash function. if !isRegularMemory(f.Type) { hashel := hashfor(f.Type) - call := ir.NewCallExpr(base.Pos, ir.OCALL, hashel, nil) + call := ir.NewCallExpr(base.Pos, ir.OCALL, hashel, nil, nil) nx := ir.NewSelectorExpr(base.Pos, ir.OXDOT, np, f.Sym) // TODO: fields from other packages? na := typecheck.NodAddr(nx) call.Args.Append(na) @@ -217,7 +217,7 @@ func genhash(t *types.Type) *obj.LSym { // h = hashel(&p.first, size, h) hashel := hashmem(f.Type) - call := ir.NewCallExpr(base.Pos, ir.OCALL, hashel, nil) + call := ir.NewCallExpr(base.Pos, ir.OCALL, hashel, nil, nil) nx := ir.NewSelectorExpr(base.Pos, ir.OXDOT, np, f.Sym) // TODO: fields from other packages? na := typecheck.NodAddr(nx) call.Args.Append(na) @@ -289,7 +289,7 @@ func hashfor(t *types.Type) ir.Node { n := typecheck.NewName(sym) ir.MarkFunc(n) - n.SetType(types.NewSignature(types.NoPkg, nil, []*types.Field{ + n.SetType(types.NewSignature(types.NoPkg, nil, nil, []*types.Field{ types.NewField(base.Pos, nil, types.NewPtr(t)), types.NewField(base.Pos, nil, types.Types[types.TUINTPTR]), }, []*types.Field{ @@ -672,7 +672,7 @@ func EqString(s, t ir.Node) (eqlen *ir.BinaryExpr, eqmem *ir.CallExpr) { fn := typecheck.LookupRuntime("memequal") fn = typecheck.SubstArgTypes(fn, types.Types[types.TUINT8], types.Types[types.TUINT8]) - call := ir.NewCallExpr(base.Pos, ir.OCALL, fn, []ir.Node{sptr, tptr, ir.Copy(slen)}) + call := ir.NewCallExpr(base.Pos, ir.OCALL, fn, nil, []ir.Node{sptr, tptr, ir.Copy(slen)}) typecheck.Call(call) cmp := ir.NewBinaryExpr(base.Pos, ir.OEQ, slen, tlen) @@ -709,7 +709,7 @@ func EqInterface(s, t ir.Node) (eqtab *ir.BinaryExpr, eqdata *ir.CallExpr) { sdata.SetTypecheck(1) tdata.SetTypecheck(1) - call := ir.NewCallExpr(base.Pos, ir.OCALL, fn, []ir.Node{stab, sdata, tdata}) + call := ir.NewCallExpr(base.Pos, ir.OCALL, fn, nil, []ir.Node{stab, sdata, tdata}) typecheck.Call(call) cmp := ir.NewBinaryExpr(base.Pos, ir.OEQ, stab, ttab) @@ -725,7 +725,7 @@ func eqmem(p ir.Node, q ir.Node, field *types.Sym, size int64) ir.Node { ny := typecheck.Expr(typecheck.NodAddr(ir.NewSelectorExpr(base.Pos, ir.OXDOT, q, field))) fn, needsize := eqmemfunc(size, nx.Type().Elem()) - call := ir.NewCallExpr(base.Pos, ir.OCALL, fn, nil) + call := ir.NewCallExpr(base.Pos, ir.OCALL, fn, nil, nil) call.Args.Append(nx) call.Args.Append(ny) if needsize { @@ -777,7 +777,7 @@ func hashmem(t *types.Type) ir.Node { n := typecheck.NewName(sym) ir.MarkFunc(n) - n.SetType(types.NewSignature(types.NoPkg, nil, []*types.Field{ + n.SetType(types.NewSignature(types.NoPkg, nil, 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]), |