diff options
author | Dan Scales <danscales@google.com> | 2021-04-09 06:30:20 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-04-09 22:57:48 +0000 |
commit | 281d168e2debf7660f9ba5006ddbc1b4cda90ab7 (patch) | |
tree | 21701a394f2e69b797ac51dade0e18b48d98bfac /src/cmd/compile/internal/inline | |
parent | 756e2b1529592ffbe1760932d14f8e6eae3fda06 (diff) | |
download | go-281d168e2debf7660f9ba5006ddbc1b4cda90ab7.tar.gz go-281d168e2debf7660f9ba5006ddbc1b4cda90ab7.zip |
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>
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r-- | src/cmd/compile/internal/inline/inl.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index 1d049298d7..1941dc44bc 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -506,7 +506,10 @@ func inlcopy(n ir.Node) ir.Node { newfn.Nname = ir.NewNameAt(oldfn.Nname.Pos(), oldfn.Nname.Sym()) // XXX OK to share fn.Type() ?? newfn.Nname.SetType(oldfn.Nname.Type()) - newfn.Nname.Ntype = inlcopy(oldfn.Nname.Ntype).(ir.Ntype) + // Ntype can be nil for -G=3 mode. + if oldfn.Nname.Ntype != nil { + newfn.Nname.Ntype = inlcopy(oldfn.Nname.Ntype).(ir.Ntype) + } newfn.Body = inlcopylist(oldfn.Body) // Make shallow copy of the Dcl and ClosureVar slices newfn.Dcl = append([]*ir.Name(nil), oldfn.Dcl...) @@ -1213,7 +1216,10 @@ func (subst *inlsubst) closure(n *ir.ClosureExpr) ir.Node { newfn.SetIsHiddenClosure(true) newfn.Nname = ir.NewNameAt(n.Pos(), ir.BlankNode.Sym()) newfn.Nname.Func = newfn - newfn.Nname.Ntype = subst.node(oldfn.Nname.Ntype).(ir.Ntype) + // Ntype can be nil for -G=3 mode. + if oldfn.Nname.Ntype != nil { + newfn.Nname.Ntype = subst.node(oldfn.Nname.Ntype).(ir.Ntype) + } newfn.Nname.Defn = newfn m.(*ir.ClosureExpr).Func = newfn |