Skip to content

Commit

Permalink
cmd/internal/gc: unembed Name field
Browse files Browse the repository at this point in the history
This is an automated follow-up to CL 10120.
It was generated with a combination of eg and gofmt -r.

No functional changes. Passes toolstash -cmp.

Change-Id: I0dc6d146372012b4cce9cc4064066daa6694eee6
Reviewed-on: https://go-review.googlesource.com/10144
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
josharian committed May 15, 2015
1 parent ef7e108 commit 8fa14ea
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/cmd/5g/ggen.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func defframe(ptxt *obj.Prog) {
r0 := uint32(0)
for l := gc.Curfn.Func.Dcl; l != nil; l = l.Next {
n = l.N
if !n.Needzero {
if !n.Name.Needzero {
continue
}
if n.Class != gc.PAUTO {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/5g/gsubr.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func split64(n *gc.Node, lo *gc.Node, hi *gc.Node) {
case gc.ONAME:
if n.Class == gc.PPARAMREF {
var n1 gc.Node
gc.Cgen(n.Heapaddr, &n1)
gc.Cgen(n.Name.Heapaddr, &n1)
sclean[nsclean-1] = n1
n = &n1
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/6g/ggen.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func defframe(ptxt *obj.Prog) {
// iterate through declarations - they are sorted in decreasing xoffset order.
for l := gc.Curfn.Func.Dcl; l != nil; l = l.Next {
n = l.N
if !n.Needzero {
if !n.Name.Needzero {
continue
}
if n.Class != gc.PAUTO {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/7g/ggen.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func defframe(ptxt *obj.Prog) {
// iterate through declarations - they are sorted in decreasing xoffset order.
for l := gc.Curfn.Func.Dcl; l != nil; l = l.Next {
n = l.N
if !n.Needzero {
if !n.Name.Needzero {
continue
}
if n.Class != gc.PAUTO {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/8g/ggen.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func defframe(ptxt *obj.Prog) {
ax := uint32(0)
for l := gc.Curfn.Func.Dcl; l != nil; l = l.Next {
n = l.N
if !n.Needzero {
if !n.Name.Needzero {
continue
}
if n.Class != gc.PAUTO {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/8g/gsubr.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ func split64(n *gc.Node, lo *gc.Node, hi *gc.Node) {
case gc.ONAME:
if n.Class == gc.PPARAMREF {
var n1 gc.Node
gc.Cgen(n.Heapaddr, &n1)
gc.Cgen(n.Name.Heapaddr, &n1)
sclean[nsclean-1] = n1
n = &n1
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/9g/ggen.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func defframe(ptxt *obj.Prog) {
// iterate through declarations - they are sorted in decreasing xoffset order.
for l := gc.Curfn.Func.Dcl; l != nil; l = l.Next {
n = l.N
if !n.Needzero {
if !n.Name.Needzero {
continue
}
if n.Class != gc.PAUTO {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/internal/gc/cgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ func Agen(n *Node, res *Node) {
Fatal("agen: bad ONAME class %#x", n.Class)
}

Cgen(n.Heapaddr, res)
Cgen(n.Name.Heapaddr, res)
if n.Xoffset != 0 {
addOffset(res, n.Xoffset)
}
Expand Down Expand Up @@ -2517,7 +2517,7 @@ func cgen_call(n *Node, proc int) {
}

// call direct
n.Left.Method = true
n.Left.Name.Method = true

Ginscall(n.Left, proc)
}
Expand Down
28 changes: 14 additions & 14 deletions src/cmd/internal/gc/closure.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ func typecheckclosure(func_ *Node, top int) {

for l := func_.Func.Cvars; l != nil; l = l.Next {
n = l.N.Closure
if !n.Captured {
n.Captured = true
if n.Decldepth == 0 {
if !n.Name.Captured {
n.Name.Captured = true
if n.Name.Decldepth == 0 {
Fatal("typecheckclosure: var %v does not have decldepth assigned", Nconv(n, obj.FmtShort))
}

// Ignore assignments to the variable in straightline code
// preceding the first capturing by a closure.
if n.Decldepth == decldepth {
if n.Name.Decldepth == decldepth {
n.Assigned = false
}
}
}

for l := func_.Func.Dcl; l != nil; l = l.Next {
if l.N.Op == ONAME && (l.N.Class == PPARAM || l.N.Class == PPARAMOUT) {
l.N.Decldepth = 1
l.N.Name.Decldepth = 1
}
}

Expand Down Expand Up @@ -254,7 +254,7 @@ func capturevars(xfunc *Node) {

// out parameters will be assigned to implicitly upon return.
if outer.Class != PPARAMOUT && !v.Closure.Addrtaken && !v.Closure.Assigned && v.Type.Width <= 128 {
v.Byval = true
v.Name.Byval = true
} else {
v.Closure.Addrtaken = true
outer = Nod(OADDR, outer, nil)
Expand All @@ -266,7 +266,7 @@ func capturevars(xfunc *Node) {
name = v.Curfn.Nname.Sym
}
how := "ref"
if v.Byval {
if v.Name.Byval {
how = "value"
}
Warnl(int(v.Lineno), "%v capturing by %s: %v (addr=%v assign=%v width=%d)", name, how, v.Sym, v.Closure.Addrtaken, v.Closure.Assigned, int32(v.Type.Width))
Expand Down Expand Up @@ -321,7 +321,7 @@ func transformclosure(xfunc *Node) {
}
fld = typ(TFIELD)
fld.Funarg = 1
if v.Byval {
if v.Name.Byval {
// If v is captured by value, we merely downgrade it to PPARAM.
v.Class = PPARAM

Expand All @@ -335,7 +335,7 @@ func transformclosure(xfunc *Node) {
addr = newname(Lookupf("&%s", v.Sym.Name))
addr.Type = Ptrto(v.Type)
addr.Class = PPARAM
v.Heapaddr = addr
v.Name.Heapaddr = addr
fld.Nname = addr
}

Expand Down Expand Up @@ -375,14 +375,14 @@ func transformclosure(xfunc *Node) {
cv = Nod(OCLOSUREVAR, nil, nil)

cv.Type = v.Type
if !v.Byval {
if !v.Name.Byval {
cv.Type = Ptrto(v.Type)
}
offset = Rnd(offset, int64(cv.Type.Align))
cv.Xoffset = offset
offset += cv.Type.Width

if v.Byval && v.Type.Width <= int64(2*Widthptr) && Thearch.Thechar == '6' {
if v.Name.Byval && v.Type.Width <= int64(2*Widthptr) && Thearch.Thechar == '6' {
// If it is a small variable captured by value, downgrade it to PAUTO.
// This optimization is currently enabled only for amd64, see:
// https://github.com/golang/go/issues/9865
Expand All @@ -400,8 +400,8 @@ func transformclosure(xfunc *Node) {
addr.Used = true
addr.Curfn = xfunc
xfunc.Func.Dcl = list(xfunc.Func.Dcl, addr)
v.Heapaddr = addr
if v.Byval {
v.Name.Heapaddr = addr
if v.Name.Byval {
cv = Nod(OADDR, cv, nil)
}
body = list(body, Nod(OAS, addr, cv))
Expand Down Expand Up @@ -448,7 +448,7 @@ func walkclosure(func_ *Node, init **NodeList) *Node {
continue
}
typ1 = typenod(v.Type)
if !v.Byval {
if !v.Name.Byval {
typ1 = Nod(OIND, typ1, nil)
}
typ.List = list(typ.List, Nod(ODCLFIELD, newname(v.Sym), typ1))
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/gc/esc.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ func esc(e *EscState, n *Node, up *Node) {
continue
}
a = v.Closure
if !v.Byval {
if !v.Name.Byval {
a = Nod(OADDR, a, nil)
a.Lineno = v.Lineno
a.Escloopdepth = e.loopdepth
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/internal/gc/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ func addrescapes(n *Node) {
oldfn := Curfn

Curfn = n.Curfn
n.Heapaddr = temp(Ptrto(n.Type))
n.Name.Heapaddr = temp(Ptrto(n.Type))
buf := fmt.Sprintf("&%v", n.Sym)
n.Heapaddr.Sym = Lookup(buf)
n.Heapaddr.Orig.Sym = n.Heapaddr.Sym
n.Name.Heapaddr.Sym = Lookup(buf)
n.Name.Heapaddr.Orig.Sym = n.Name.Heapaddr.Sym
n.Esc = EscHeap
if Debug['m'] != 0 {
fmt.Printf("%v: moved to heap: %v\n", n.Line(), n)
Expand Down Expand Up @@ -262,7 +262,7 @@ func cgen_dcl(n *Node) {
if n.Alloc == nil {
n.Alloc = callnew(n.Type)
}
Cgen_as(n.Heapaddr, n.Alloc)
Cgen_as(n.Name.Heapaddr, n.Alloc)
}

/*
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/internal/gc/gsubr.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func ggloblnod(nam *Node) {
p.To.Sym = nil
p.To.Type = obj.TYPE_CONST
p.To.Offset = nam.Type.Width
if nam.Readonly {
if nam.Name.Readonly {
p.From3.Offset = obj.RODATA
}
if nam.Type != nil && !haspointers(nam.Type) {
Expand Down Expand Up @@ -369,7 +369,7 @@ func Naddr(a *obj.Addr, n *Node) {
if s == nil {
s = Lookup(".noname")
}
if n.Method {
if n.Name.Method {
if n.Type != nil {
if n.Type.Sym != nil {
if n.Type.Sym.Pkg != nil {
Expand Down
22 changes: 11 additions & 11 deletions src/cmd/internal/gc/inl.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ func mkinlcall(np **Node, fn *Node, isddd bool) {

func tinlvar(t *Type) *Node {
if t.Nname != nil && !isblank(t.Nname) {
if t.Nname.Inlvar == nil {
if t.Nname.Name.Inlvar == nil {
Fatal("missing inlvar for %v\n", t.Nname)
}
return t.Nname.Inlvar
return t.Nname.Name.Inlvar
}

typecheck(&nblank, Erv|Easgn)
Expand Down Expand Up @@ -577,13 +577,13 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
continue
}
if ll.N.Op == ONAME {
ll.N.Inlvar = inlvar(ll.N)
ll.N.Name.Inlvar = inlvar(ll.N)

// Typecheck because inlvar is not necessarily a function parameter.
typecheck(&ll.N.Inlvar, Erv)
typecheck(&ll.N.Name.Inlvar, Erv)

if ll.N.Class&^PHEAP != PAUTO {
ninit = list(ninit, Nod(ODCL, ll.N.Inlvar, nil)) // otherwise gen won't emit the allocations for heapallocs
ninit = list(ninit, Nod(ODCL, ll.N.Name.Inlvar, nil)) // otherwise gen won't emit the allocations for heapallocs
}
}
}
Expand All @@ -594,7 +594,7 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
if t != nil && t.Nname != nil && !isblank(t.Nname) {
m = inlvar(t.Nname)
typecheck(&m, Erv)
t.Nname.Inlvar = m
t.Nname.Name.Inlvar = m
} else {
// anonymous return values, synthesize names for use in assignment that replaces return
m = retvar(t, i)
Expand All @@ -611,7 +611,7 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
// method call with a receiver.
t := getthisx(fn.Type).Type

if t != nil && t.Nname != nil && !isblank(t.Nname) && t.Nname.Inlvar == nil {
if t != nil && t.Nname != nil && !isblank(t.Nname) && t.Nname.Name.Inlvar == nil {
Fatal("missing inlvar for %v\n", t.Nname)
}
if n.Left.Left == nil {
Expand Down Expand Up @@ -680,7 +680,7 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
// append receiver inlvar to LHS.
t := getthisx(fn.Type).Type

if t != nil && t.Nname != nil && !isblank(t.Nname) && t.Nname.Inlvar == nil {
if t != nil && t.Nname != nil && !isblank(t.Nname) && t.Nname.Name.Inlvar == nil {
Fatal("missing inlvar for %v\n", t.Nname)
}
if t == nil {
Expand Down Expand Up @@ -907,11 +907,11 @@ func inlsubst(n *Node) *Node {

switch n.Op {
case ONAME:
if n.Inlvar != nil { // These will be set during inlnode
if n.Name.Inlvar != nil { // These will be set during inlnode
if Debug['m'] > 2 {
fmt.Printf("substituting name %v -> %v\n", Nconv(n, obj.FmtSign), Nconv(n.Inlvar, obj.FmtSign))
fmt.Printf("substituting name %v -> %v\n", Nconv(n, obj.FmtSign), Nconv(n.Name.Inlvar, obj.FmtSign))
}
return n.Inlvar
return n.Name.Inlvar
}

if Debug['m'] > 2 {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/internal/gc/pgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ func cmpstackvar(a *Node, b *Node) int {
return bp - ap
}

ap = obj.Bool2int(a.Needzero)
bp = obj.Bool2int(b.Needzero)
ap = obj.Bool2int(a.Name.Needzero)
bp = obj.Bool2int(b.Name.Needzero)
if ap != bp {
return bp - ap
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/internal/gc/plive.go
Original file line number Diff line number Diff line change
Expand Up @@ -1281,8 +1281,8 @@ func livenessepilogue(lv *Liveness) {
}
bvset(all, pos) // silence future warnings in this block
n = lv.vars[pos]
if !n.Needzero {
n.Needzero = true
if !n.Name.Needzero {
n.Name.Needzero = true
if debuglive >= 1 {
Warnl(int(p.Lineno), "%v: %v is ambiguously live", Curfn.Nname, Nconv(n, obj.FmtLong))
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/gc/sinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ func staticname(t *Type, ctxt int) *Node {
n := newname(Lookupf("statictmp_%.4d", statuniqgen))
statuniqgen++
if ctxt == 0 {
n.Readonly = true
n.Name.Readonly = true
}
addvar(n, t, PEXTERN)
return n
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/gc/syntax.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type Node struct {
Reg int16

// ONAME
*Name
Name *Name
Ntype *Node
Defn *Node // ONAME: initializing assignment; OLABEL: labeled statement
Pack *Node // real package for import . names
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/internal/gc/typecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ OpSwitch:
break OpSwitch

case ONAME:
if n.Decldepth == 0 {
n.Decldepth = decldepth
if n.Name.Decldepth == 0 {
n.Name.Decldepth = decldepth
}
if n.Etype != 0 {
ok |= Ecall
Expand Down Expand Up @@ -3521,7 +3521,7 @@ func typecheckfunc(n *Node) {

for l := n.Func.Dcl; l != nil; l = l.Next {
if l.N.Op == ONAME && (l.N.Class == PPARAM || l.N.Class == PPARAMOUT) {
l.N.Decldepth = 1
l.N.Name.Decldepth = 1
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/gc/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -2719,7 +2719,7 @@ func paramstoheap(argin **Type, out int) *NodeList {
if v.Alloc == nil {
v.Alloc = callnew(v.Type)
}
nn = list(nn, Nod(OAS, v.Heapaddr, v.Alloc))
nn = list(nn, Nod(OAS, v.Name.Heapaddr, v.Alloc))
if v.Class&^PHEAP != PPARAMOUT {
as = Nod(OAS, v, v.Stackparam)
v.Stackparam.Typecheck = 1
Expand Down

0 comments on commit 8fa14ea

Please sign in to comment.