cmd/compile: don't set Ntype in noder2 anymore

Now that we are no longer calling the old typechecker at all during the
noder2 pass, we don't need to create and set an Ntype node ((which is
just a node representation of the type which we already know) for the
Name and Closure nodes. This should reduce memory usage a bit for -G=3.

Change-Id: I6b1345007ce067a89ee64955a53f25645c303f4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/308909
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Dan Scales 2021-04-09 06:30:20 -07:00
parent 756e2b1529
commit 281d168e2d
4 changed files with 9 additions and 12 deletions

View file

@ -298,7 +298,6 @@ func (g *irgen) genericSubst(newsym *types.Sym, nameNode *ir.Name, targs []ir.No
subst.fields(ir.PPARAM, append(oldt.Recvs().FieldSlice(), oldt.Params().FieldSlice()...), newf.Dcl),
subst.fields(ir.PPARAMOUT, oldt.Results().FieldSlice(), newf.Dcl))
newf.Nname.Ntype = ir.TypeNode(newt)
newf.Nname.SetType(newt)
ir.MarkFunc(newf.Nname)
newf.SetTypecheck(1)
@ -497,8 +496,7 @@ func (subst *subster) node(n ir.Node) ir.Node {
case ir.OCLOSURE:
x := x.(*ir.ClosureExpr)
// Need to save/duplicate x.Func.Nname,
// x.Func.Nname.Ntype, x.Func.Dcl, x.Func.ClosureVars, and
// Need to duplicate x.Func.Nname, x.Func.Dcl, x.Func.ClosureVars, and
// x.Func.Body.
oldfn := x.Func
newfn := ir.NewFunc(oldfn.Pos())
@ -522,8 +520,6 @@ func (subst *subster) node(n ir.Node) ir.Node {
newfn.Dcl = subst.namelist(oldfn.Dcl)
newfn.ClosureVars = subst.namelist(oldfn.ClosureVars)
// Set Ntype for now to be compatible with later parts of compiler
newfn.Nname.Ntype = subst.node(oldfn.Nname.Ntype).(ir.Ntype)
typed(subst.typ(oldfn.Nname.Type()), newfn.Nname)
typed(newfn.Nname.Type(), m)
newfn.SetTypecheck(1)