aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-05-27 10:44:23 -0400
committerRuss Cox <rsc@golang.org>2015-06-03 20:10:42 +0000
commitf1f0eda44663110fe1857780f080af0f8eea6ed9 (patch)
tree0e108170e74b3243cc3803eb4e8745a5db36cf20 /src
parentda094f19f1aea32d0469d01a4c5a53fc9379569f (diff)
downloadgo-f1f0eda44663110fe1857780f080af0f8eea6ed9.tar.xz
cmd/compile: remove use of Node.Nname in initplan
$ sizeof -p cmd/compile/internal/gc Node Node 168 $ Change-Id: Ie7e2cee8cec101560bd5dd013b23969278f89b12 Reviewed-on: https://go-review.googlesource.com/10536 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/sinit.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/gc/sinit.go b/src/cmd/compile/internal/gc/sinit.go
index 53867d90f4..c00e3c1d76 100644
--- a/src/cmd/compile/internal/gc/sinit.go
+++ b/src/cmd/compile/internal/gc/sinit.go
@@ -20,6 +20,7 @@ const (
var initlist *NodeList
var initplans = make(map[*Node]*InitPlan)
+var inittemps = make(map[*Node]*Node)
// init1 walks the AST starting at n, and accumulates in out
// the list of definitions needing init code in dependency order.
@@ -327,7 +328,7 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool {
// copy pointer
case OARRAYLIT, OSTRUCTLIT, OMAPLIT:
- gdata(l, Nod(OADDR, r.Nname, nil), int(l.Type.Width))
+ gdata(l, Nod(OADDR, inittemps[r], nil), int(l.Type.Width))
return true
}
@@ -335,7 +336,7 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool {
case OARRAYLIT:
if Isslice(r.Type) {
// copy slice
- a := r.Nname
+ a := inittemps[r]
n1 := *l
n1.Xoffset = l.Xoffset + int64(Array_array)
@@ -424,7 +425,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool {
case OARRAYLIT, OMAPLIT, OSTRUCTLIT:
a := staticname(r.Left.Type, 1)
- r.Nname = a
+ inittemps[r] = a
gdata(l, Nod(OADDR, a, nil), int(l.Type.Width))
// Init underlying literal.
@@ -450,7 +451,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool {
ta.Type = r.Type.Type
ta.Bound = Mpgetfix(r.Right.Val.U.(*Mpint))
a := staticname(ta, 1)
- r.Nname = a
+ inittemps[r] = a
n1 = *l
n1.Xoffset = l.Xoffset + int64(Array_array)
gdata(&n1, Nod(OADDR, a, nil), Widthptr)