Commit f1f0eda4 authored by Russ Cox's avatar Russ Cox

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/10536Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
parent da094f19
...@@ -20,6 +20,7 @@ const ( ...@@ -20,6 +20,7 @@ const (
var initlist *NodeList var initlist *NodeList
var initplans = make(map[*Node]*InitPlan) var initplans = make(map[*Node]*InitPlan)
var inittemps = make(map[*Node]*Node)
// init1 walks the AST starting at n, and accumulates in out // init1 walks the AST starting at n, and accumulates in out
// the list of definitions needing init code in dependency order. // the list of definitions needing init code in dependency order.
...@@ -327,7 +328,7 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool { ...@@ -327,7 +328,7 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool {
// copy pointer // copy pointer
case OARRAYLIT, OSTRUCTLIT, OMAPLIT: 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 return true
} }
...@@ -335,7 +336,7 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool { ...@@ -335,7 +336,7 @@ func staticcopy(l *Node, r *Node, out **NodeList) bool {
case OARRAYLIT: case OARRAYLIT:
if Isslice(r.Type) { if Isslice(r.Type) {
// copy slice // copy slice
a := r.Nname a := inittemps[r]
n1 := *l n1 := *l
n1.Xoffset = l.Xoffset + int64(Array_array) n1.Xoffset = l.Xoffset + int64(Array_array)
...@@ -424,7 +425,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool { ...@@ -424,7 +425,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool {
case OARRAYLIT, OMAPLIT, OSTRUCTLIT: case OARRAYLIT, OMAPLIT, OSTRUCTLIT:
a := staticname(r.Left.Type, 1) a := staticname(r.Left.Type, 1)
r.Nname = a inittemps[r] = a
gdata(l, Nod(OADDR, a, nil), int(l.Type.Width)) gdata(l, Nod(OADDR, a, nil), int(l.Type.Width))
// Init underlying literal. // Init underlying literal.
...@@ -450,7 +451,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool { ...@@ -450,7 +451,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool {
ta.Type = r.Type.Type ta.Type = r.Type.Type
ta.Bound = Mpgetfix(r.Right.Val.U.(*Mpint)) ta.Bound = Mpgetfix(r.Right.Val.U.(*Mpint))
a := staticname(ta, 1) a := staticname(ta, 1)
r.Nname = a inittemps[r] = a
n1 = *l n1 = *l
n1.Xoffset = l.Xoffset + int64(Array_array) n1.Xoffset = l.Xoffset + int64(Array_array)
gdata(&n1, Nod(OADDR, a, nil), Widthptr) gdata(&n1, Nod(OADDR, a, nil), Widthptr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment