mirror of
https://github.com/golang/go
synced 2024-11-19 14:04:46 -07:00
cmd/compile: change export.go and fmt.go to use nodeSeq
Also fix some uses of nodeSeqIterator.Len, and fix the implementation in nodesIterator. Passes toolstash -cmp. Update #14473. Change-Id: I228871470234b7f1314ffd2aae8a4c0624c35f98 Reviewed-on: https://go-review.googlesource.com/20231 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
3375974e0d
commit
55c65d4a97
@ -296,7 +296,7 @@ func genhash(sym *Sym, t *Type) {
|
|||||||
fn.Nbody.Append(r)
|
fn.Nbody.Append(r)
|
||||||
|
|
||||||
if Debug['r'] != 0 {
|
if Debug['r'] != 0 {
|
||||||
dumpslice("genhash body", fn.Nbody.Slice())
|
dumplist("genhash body", fn.Nbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
funcbody(fn)
|
funcbody(fn)
|
||||||
@ -504,7 +504,7 @@ func geneq(sym *Sym, t *Type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if Debug['r'] != 0 {
|
if Debug['r'] != 0 {
|
||||||
dumpslice("geneq body", fn.Nbody.Slice())
|
dumplist("geneq body", fn.Nbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
funcbody(fn)
|
funcbody(fn)
|
||||||
|
@ -333,7 +333,7 @@ func Export(out *obj.Biobuf, trace bool) int {
|
|||||||
}
|
}
|
||||||
for _, f := range p.inlined {
|
for _, f := range p.inlined {
|
||||||
if p.trace {
|
if p.trace {
|
||||||
p.tracef("{ %s }\n", Hconvslice(f.Inl.Slice(), obj.FmtSharp))
|
p.tracef("{ %s }\n", Hconv(f.Inl, obj.FmtSharp))
|
||||||
}
|
}
|
||||||
p.nodeList(f.Inl)
|
p.nodeList(f.Inl)
|
||||||
if p.trace {
|
if p.trace {
|
||||||
@ -813,7 +813,7 @@ func (p *exporter) nodeList(list nodesOrNodeList) {
|
|||||||
}
|
}
|
||||||
p.int(it.Len())
|
p.int(it.Len())
|
||||||
if p.trace {
|
if p.trace {
|
||||||
if it.Len() == 0 {
|
if it.Len() <= 1 {
|
||||||
p.tracef("] {}")
|
p.tracef("] {}")
|
||||||
} else {
|
} else {
|
||||||
p.tracef("] {>")
|
p.tracef("] {>")
|
||||||
|
@ -106,15 +106,9 @@ func dumppkg(p *Pkg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look for anything we need for the inline body
|
// Look for anything we need for the inline body
|
||||||
func reexportdeplist(ll *NodeList) {
|
func reexportdeplist(ll nodesOrNodeList) {
|
||||||
for ; ll != nil; ll = ll.Next {
|
for it := nodeSeqIterate(ll); !it.Done(); it.Next() {
|
||||||
reexportdep(ll.N)
|
reexportdep(it.N())
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func reexportdepslice(ll []*Node) {
|
|
||||||
for _, n := range ll {
|
|
||||||
reexportdep(n)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +217,7 @@ func reexportdep(n *Node) {
|
|||||||
reexportdeplist(n.List)
|
reexportdeplist(n.List)
|
||||||
reexportdeplist(n.Rlist)
|
reexportdeplist(n.Rlist)
|
||||||
reexportdeplist(n.Ninit)
|
reexportdeplist(n.Ninit)
|
||||||
reexportdepslice(n.Nbody.Slice())
|
reexportdeplist(n.Nbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpexportconst(s *Sym) {
|
func dumpexportconst(s *Sym) {
|
||||||
@ -263,9 +257,9 @@ func dumpexportvar(s *Sym) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: The space after %#S here is necessary for ld's export data parser.
|
// NOTE: The space after %#S here is necessary for ld's export data parser.
|
||||||
exportf("\tfunc %v %v { %v }\n", Sconv(s, obj.FmtSharp), Tconv(t, obj.FmtShort|obj.FmtSharp), Hconvslice(n.Func.Inl.Slice(), obj.FmtSharp|obj.FmtBody))
|
exportf("\tfunc %v %v { %v }\n", Sconv(s, obj.FmtSharp), Tconv(t, obj.FmtShort|obj.FmtSharp), Hconv(n.Func.Inl, obj.FmtSharp|obj.FmtBody))
|
||||||
|
|
||||||
reexportdepslice(n.Func.Inl.Slice())
|
reexportdeplist(n.Func.Inl)
|
||||||
} else {
|
} else {
|
||||||
exportf("\tfunc %v %v\n", Sconv(s, obj.FmtSharp), Tconv(t, obj.FmtShort|obj.FmtSharp))
|
exportf("\tfunc %v %v\n", Sconv(s, obj.FmtSharp), Tconv(t, obj.FmtShort|obj.FmtSharp))
|
||||||
}
|
}
|
||||||
@ -320,8 +314,8 @@ func dumpexporttype(t *Type) {
|
|||||||
if Debug['l'] < 2 {
|
if Debug['l'] < 2 {
|
||||||
typecheckinl(f.Type.Nname)
|
typecheckinl(f.Type.Nname)
|
||||||
}
|
}
|
||||||
exportf("\tfunc (%v) %v %v { %v }\n", Tconv(getthisx(f.Type).Type, obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp), Hconvslice(f.Type.Nname.Func.Inl.Slice(), obj.FmtSharp))
|
exportf("\tfunc (%v) %v %v { %v }\n", Tconv(getthisx(f.Type).Type, obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp), Hconv(f.Type.Nname.Func.Inl, obj.FmtSharp))
|
||||||
reexportdepslice(f.Type.Nname.Func.Inl.Slice())
|
reexportdeplist(f.Type.Nname.Func.Inl)
|
||||||
} else {
|
} else {
|
||||||
exportf("\tfunc (%v) %v %v\n", Tconv(getthisx(f.Type).Type, obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp))
|
exportf("\tfunc (%v) %v %v\n", Tconv(getthisx(f.Type).Type, obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp))
|
||||||
}
|
}
|
||||||
|
@ -800,10 +800,10 @@ func stmtfmt(n *Node) string {
|
|||||||
// block starting with the init statements.
|
// block starting with the init statements.
|
||||||
|
|
||||||
// if we can just say "for" n->ninit; ... then do so
|
// if we can just say "for" n->ninit; ... then do so
|
||||||
simpleinit := n.Ninit != nil && n.Ninit.Next == nil && n.Ninit.N.Ninit == nil && stmtwithinit(n.Op)
|
simpleinit := nodeSeqLen(n.Ninit) == 1 && nodeSeqLen(nodeSeqFirst(n.Ninit).Ninit) == 0 && stmtwithinit(n.Op)
|
||||||
|
|
||||||
// otherwise, print the inits as separate statements
|
// otherwise, print the inits as separate statements
|
||||||
complexinit := n.Ninit != nil && !simpleinit && (fmtmode != FErr)
|
complexinit := nodeSeqLen(n.Ninit) != 0 && !simpleinit && (fmtmode != FErr)
|
||||||
|
|
||||||
// but if it was for if/for/switch, put in an extra surrounding block to limit the scope
|
// but if it was for if/for/switch, put in an extra surrounding block to limit the scope
|
||||||
extrablock := complexinit && stmtwithinit(n.Op)
|
extrablock := complexinit && stmtwithinit(n.Op)
|
||||||
@ -889,7 +889,7 @@ func stmtfmt(n *Node) string {
|
|||||||
} else {
|
} else {
|
||||||
f += fmt.Sprintf("if %v { %v }", n.Left, n.Nbody)
|
f += fmt.Sprintf("if %v { %v }", n.Left, n.Nbody)
|
||||||
}
|
}
|
||||||
if n.Rlist != nil {
|
if nodeSeqLen(n.Rlist) != 0 {
|
||||||
f += fmt.Sprintf(" else { %v }", n.Rlist)
|
f += fmt.Sprintf(" else { %v }", n.Rlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,7 +901,7 @@ func stmtfmt(n *Node) string {
|
|||||||
|
|
||||||
f += "for"
|
f += "for"
|
||||||
if simpleinit {
|
if simpleinit {
|
||||||
f += fmt.Sprintf(" %v;", n.Ninit.N)
|
f += fmt.Sprintf(" %v;", nodeSeqFirst(n.Ninit))
|
||||||
} else if n.Right != nil {
|
} else if n.Right != nil {
|
||||||
f += " ;"
|
f += " ;"
|
||||||
}
|
}
|
||||||
@ -924,7 +924,7 @@ func stmtfmt(n *Node) string {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.List == nil {
|
if nodeSeqLen(n.List) == 0 {
|
||||||
f += fmt.Sprintf("for range %v { %v }", n.Right, n.Nbody)
|
f += fmt.Sprintf("for range %v { %v }", n.Right, n.Nbody)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -939,7 +939,7 @@ func stmtfmt(n *Node) string {
|
|||||||
|
|
||||||
f += Oconv(int(n.Op), obj.FmtSharp)
|
f += Oconv(int(n.Op), obj.FmtSharp)
|
||||||
if simpleinit {
|
if simpleinit {
|
||||||
f += fmt.Sprintf(" %v;", n.Ninit.N)
|
f += fmt.Sprintf(" %v;", nodeSeqFirst(n.Ninit))
|
||||||
}
|
}
|
||||||
if n.Left != nil {
|
if n.Left != nil {
|
||||||
f += Nconv(n.Left, 0)
|
f += Nconv(n.Left, 0)
|
||||||
@ -948,7 +948,7 @@ func stmtfmt(n *Node) string {
|
|||||||
f += fmt.Sprintf(" { %v }", n.List)
|
f += fmt.Sprintf(" { %v }", n.List)
|
||||||
|
|
||||||
case OCASE, OXCASE:
|
case OCASE, OXCASE:
|
||||||
if n.List != nil {
|
if nodeSeqLen(n.List) != 0 {
|
||||||
f += fmt.Sprintf("case %v: %v", Hconv(n.List, obj.FmtComma), n.Nbody)
|
f += fmt.Sprintf("case %v: %v", Hconv(n.List, obj.FmtComma), n.Nbody)
|
||||||
} else {
|
} else {
|
||||||
f += fmt.Sprintf("default: %v", n.Nbody)
|
f += fmt.Sprintf("default: %v", n.Nbody)
|
||||||
@ -1257,10 +1257,10 @@ func exprfmt(n *Node, prec int) string {
|
|||||||
} else {
|
} else {
|
||||||
f += fmt.Sprintf("(%v{", n.Type)
|
f += fmt.Sprintf("(%v{", n.Type)
|
||||||
}
|
}
|
||||||
for l := n.List; l != nil; l = l.Next {
|
for it := nodeSeqIterate(n.List); !it.Done(); it.Next() {
|
||||||
f += fmt.Sprintf(" %v:%v", Sconv(l.N.Left.Sym, obj.FmtShort|obj.FmtByte), l.N.Right)
|
f += fmt.Sprintf(" %v:%v", Sconv(it.N().Left.Sym, obj.FmtShort|obj.FmtByte), it.N().Right)
|
||||||
|
|
||||||
if l.Next != nil {
|
if it.Len() > 1 {
|
||||||
f += ","
|
f += ","
|
||||||
} else {
|
} else {
|
||||||
f += " "
|
f += " "
|
||||||
@ -1391,7 +1391,7 @@ func exprfmt(n *Node, prec int) string {
|
|||||||
return f
|
return f
|
||||||
|
|
||||||
case OMAKEMAP, OMAKECHAN, OMAKESLICE:
|
case OMAKEMAP, OMAKECHAN, OMAKESLICE:
|
||||||
if n.List != nil { // pre-typecheck
|
if nodeSeqLen(n.List) != 0 { // pre-typecheck
|
||||||
return fmt.Sprintf("make(%v, %v)", n.Type, Hconv(n.List, obj.FmtComma))
|
return fmt.Sprintf("make(%v, %v)", n.Type, Hconv(n.List, obj.FmtComma))
|
||||||
}
|
}
|
||||||
if n.Right != nil {
|
if n.Right != nil {
|
||||||
@ -1449,11 +1449,13 @@ func exprfmt(n *Node, prec int) string {
|
|||||||
|
|
||||||
case OADDSTR:
|
case OADDSTR:
|
||||||
var f string
|
var f string
|
||||||
for l := n.List; l != nil; l = l.Next {
|
i := 0
|
||||||
if l != n.List {
|
for it := nodeSeqIterate(n.List); !it.Done(); it.Next() {
|
||||||
|
if i != 0 {
|
||||||
f += " + "
|
f += " + "
|
||||||
}
|
}
|
||||||
f += exprfmt(l.N, nprec)
|
f += exprfmt(it.N(), nprec)
|
||||||
|
i++
|
||||||
}
|
}
|
||||||
|
|
||||||
return f
|
return f
|
||||||
@ -1521,7 +1523,7 @@ func nodedump(n *Node, flag int) string {
|
|||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.Ninit != nil {
|
if nodeSeqLen(n.Ninit) != 0 {
|
||||||
fmt.Fprintf(&buf, "%v-init%v", Oconv(int(n.Op), 0), n.Ninit)
|
fmt.Fprintf(&buf, "%v-init%v", Oconv(int(n.Op), 0), n.Ninit)
|
||||||
indent(&buf)
|
indent(&buf)
|
||||||
}
|
}
|
||||||
@ -1574,12 +1576,12 @@ func nodedump(n *Node, flag int) string {
|
|||||||
if n.Right != nil {
|
if n.Right != nil {
|
||||||
buf.WriteString(Nconv(n.Right, 0))
|
buf.WriteString(Nconv(n.Right, 0))
|
||||||
}
|
}
|
||||||
if n.List != nil {
|
if nodeSeqLen(n.List) != 0 {
|
||||||
indent(&buf)
|
indent(&buf)
|
||||||
fmt.Fprintf(&buf, "%v-list%v", Oconv(int(n.Op), 0), n.List)
|
fmt.Fprintf(&buf, "%v-list%v", Oconv(int(n.Op), 0), n.List)
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.Rlist != nil {
|
if nodeSeqLen(n.Rlist) != 0 {
|
||||||
indent(&buf)
|
indent(&buf)
|
||||||
fmt.Fprintf(&buf, "%v-rlist%v", Oconv(int(n.Op), 0), n.Rlist)
|
fmt.Fprintf(&buf, "%v-rlist%v", Oconv(int(n.Op), 0), n.Rlist)
|
||||||
}
|
}
|
||||||
@ -1701,13 +1703,13 @@ func (l *NodeList) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n Nodes) String() string {
|
func (n Nodes) String() string {
|
||||||
return Hconvslice(n.Slice(), 0)
|
return Hconv(n, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fmt '%H': NodeList.
|
// Fmt '%H': NodeList.
|
||||||
// Flags: all those of %N plus ',': separate with comma's instead of semicolons.
|
// Flags: all those of %N plus ',': separate with comma's instead of semicolons.
|
||||||
func Hconv(l *NodeList, flag int) string {
|
func Hconv(l nodesOrNodeList, flag int) string {
|
||||||
if l == nil && fmtmode == FDbg {
|
if nodeSeqLen(l) == 0 && fmtmode == FDbg {
|
||||||
return "<nil>"
|
return "<nil>"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1721,9 +1723,9 @@ func Hconv(l *NodeList, flag int) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
for ; l != nil; l = l.Next {
|
for it := nodeSeqIterate(l); !it.Done(); it.Next() {
|
||||||
buf.WriteString(Nconv(l.N, 0))
|
buf.WriteString(Nconv(it.N(), 0))
|
||||||
if l.Next != nil {
|
if it.Len() > 1 {
|
||||||
buf.WriteString(sep)
|
buf.WriteString(sep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1734,42 +1736,10 @@ func Hconv(l *NodeList, flag int) string {
|
|||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func Hconvslice(l []*Node, flag int) string {
|
func dumplist(s string, l nodesOrNodeList) {
|
||||||
if len(l) == 0 && fmtmode == FDbg {
|
|
||||||
return "<nil>"
|
|
||||||
}
|
|
||||||
|
|
||||||
sf := flag
|
|
||||||
sm, sb := setfmode(&flag)
|
|
||||||
sep := "; "
|
|
||||||
if fmtmode == FDbg {
|
|
||||||
sep = "\n"
|
|
||||||
} else if flag&obj.FmtComma != 0 {
|
|
||||||
sep = ", "
|
|
||||||
}
|
|
||||||
|
|
||||||
var buf bytes.Buffer
|
|
||||||
for i, n := range l {
|
|
||||||
buf.WriteString(Nconv(n, 0))
|
|
||||||
if i+1 < len(l) {
|
|
||||||
buf.WriteString(sep)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flag = sf
|
|
||||||
fmtbody = sb
|
|
||||||
fmtmode = sm
|
|
||||||
return buf.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
func dumplist(s string, l *NodeList) {
|
|
||||||
fmt.Printf("%s%v\n", s, Hconv(l, obj.FmtSign))
|
fmt.Printf("%s%v\n", s, Hconv(l, obj.FmtSign))
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpslice(s string, l []*Node) {
|
|
||||||
fmt.Printf("%s%v\n", s, Hconvslice(l, obj.FmtSign))
|
|
||||||
}
|
|
||||||
|
|
||||||
func Dump(s string, n *Node) {
|
func Dump(s string, n *Node) {
|
||||||
fmt.Printf("%s [%p]%v\n", s, n, Nconv(n, obj.FmtSign))
|
fmt.Printf("%s [%p]%v\n", s, n, Nconv(n, obj.FmtSign))
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func typecheckinl(fn *Node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if Debug['m'] > 2 {
|
if Debug['m'] > 2 {
|
||||||
fmt.Printf("typecheck import [%v] %v { %v }\n", fn.Sym, Nconv(fn, obj.FmtLong), Hconvslice(fn.Func.Inl.Slice(), obj.FmtSharp))
|
fmt.Printf("typecheck import [%v] %v { %v }\n", fn.Sym, Nconv(fn, obj.FmtLong), Hconv(fn.Func.Inl, obj.FmtSharp))
|
||||||
}
|
}
|
||||||
|
|
||||||
save_safemode := safemode
|
save_safemode := safemode
|
||||||
@ -161,7 +161,7 @@ func caninl(fn *Node) {
|
|||||||
fn.Type.Nname = fn.Func.Nname
|
fn.Type.Nname = fn.Func.Nname
|
||||||
|
|
||||||
if Debug['m'] > 1 {
|
if Debug['m'] > 1 {
|
||||||
fmt.Printf("%v: can inline %v as: %v { %v }\n", fn.Line(), Nconv(fn.Func.Nname, obj.FmtSharp), Tconv(fn.Type, obj.FmtSharp), Hconvslice(fn.Func.Nname.Func.Inl.Slice(), obj.FmtSharp))
|
fmt.Printf("%v: can inline %v as: %v { %v }\n", fn.Line(), Nconv(fn.Func.Nname, obj.FmtSharp), Tconv(fn.Type, obj.FmtSharp), Hconv(fn.Func.Nname.Func.Inl, obj.FmtSharp))
|
||||||
} else if Debug['m'] != 0 {
|
} else if Debug['m'] != 0 {
|
||||||
fmt.Printf("%v: can inline %v\n", fn.Line(), fn.Func.Nname)
|
fmt.Printf("%v: can inline %v\n", fn.Line(), fn.Func.Nname)
|
||||||
}
|
}
|
||||||
@ -543,7 +543,7 @@ func mkinlcall1(np **Node, fn *Node, isddd bool) {
|
|||||||
|
|
||||||
// Bingo, we have a function node, and it has an inlineable body
|
// Bingo, we have a function node, and it has an inlineable body
|
||||||
if Debug['m'] > 1 {
|
if Debug['m'] > 1 {
|
||||||
fmt.Printf("%v: inlining call to %v %v { %v }\n", n.Line(), fn.Sym, Tconv(fn.Type, obj.FmtSharp), Hconvslice(fn.Func.Inl.Slice(), obj.FmtSharp))
|
fmt.Printf("%v: inlining call to %v %v { %v }\n", n.Line(), fn.Sym, Tconv(fn.Type, obj.FmtSharp), Hconv(fn.Func.Inl, obj.FmtSharp))
|
||||||
} else if Debug['m'] != 0 {
|
} else if Debug['m'] != 0 {
|
||||||
fmt.Printf("%v: inlining call to %v\n", n.Line(), fn)
|
fmt.Printf("%v: inlining call to %v\n", n.Line(), fn)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ type Order struct {
|
|||||||
func order(fn *Node) {
|
func order(fn *Node) {
|
||||||
if Debug['W'] > 1 {
|
if Debug['W'] > 1 {
|
||||||
s := fmt.Sprintf("\nbefore order %v", fn.Func.Nname.Sym)
|
s := fmt.Sprintf("\nbefore order %v", fn.Func.Nname.Sym)
|
||||||
dumpslice(s, fn.Nbody.Slice())
|
dumplist(s, fn.Nbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
orderblockNodes(&fn.Nbody)
|
orderblockNodes(&fn.Nbody)
|
||||||
|
@ -78,11 +78,11 @@ func instrument(fn *Node) {
|
|||||||
|
|
||||||
if Debug['W'] != 0 {
|
if Debug['W'] != 0 {
|
||||||
s := fmt.Sprintf("after instrument %v", fn.Func.Nname.Sym)
|
s := fmt.Sprintf("after instrument %v", fn.Func.Nname.Sym)
|
||||||
dumpslice(s, fn.Nbody.Slice())
|
dumplist(s, fn.Nbody)
|
||||||
s = fmt.Sprintf("enter %v", fn.Func.Nname.Sym)
|
s = fmt.Sprintf("enter %v", fn.Func.Nname.Sym)
|
||||||
dumpslice(s, fn.Func.Enter.Slice())
|
dumplist(s, fn.Func.Enter)
|
||||||
s = fmt.Sprintf("exit %v", fn.Func.Nname.Sym)
|
s = fmt.Sprintf("exit %v", fn.Func.Nname.Sym)
|
||||||
dumpslice(s, fn.Func.Exit.Slice())
|
dumplist(s, fn.Func.Exit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ func buildssa(fn *Node) *ssa.Func {
|
|||||||
printssa := name == os.Getenv("GOSSAFUNC")
|
printssa := name == os.Getenv("GOSSAFUNC")
|
||||||
if printssa {
|
if printssa {
|
||||||
fmt.Println("generating SSA for", name)
|
fmt.Println("generating SSA for", name)
|
||||||
dumpslice("buildssa-enter", fn.Func.Enter.Slice())
|
dumplist("buildssa-enter", fn.Func.Enter)
|
||||||
dumpslice("buildssa-body", fn.Nbody.Slice())
|
dumplist("buildssa-body", fn.Nbody)
|
||||||
dumpslice("buildssa-exit", fn.Func.Exit.Slice())
|
dumplist("buildssa-exit", fn.Func.Exit)
|
||||||
}
|
}
|
||||||
|
|
||||||
var s state
|
var s state
|
||||||
|
@ -2185,7 +2185,7 @@ func genwrapper(rcvr *Type, method *Type, newnam *Sym, iface int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if false && Debug['r'] != 0 {
|
if false && Debug['r'] != 0 {
|
||||||
dumpslice("genwrapper body", fn.Nbody.Slice())
|
dumplist("genwrapper body", fn.Nbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
funcbody(fn)
|
funcbody(fn)
|
||||||
|
@ -578,7 +578,7 @@ func (ni *nodesIterator) P() **Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ni *nodesIterator) Len() int {
|
func (ni *nodesIterator) Len() int {
|
||||||
return len(ni.n.Slice())
|
return len(ni.n.Slice()[ni.i:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ni *nodesIterator) Seq() nodesOrNodeList {
|
func (ni *nodesIterator) Seq() nodesOrNodeList {
|
||||||
|
@ -22,7 +22,7 @@ func walk(fn *Node) {
|
|||||||
|
|
||||||
if Debug['W'] != 0 {
|
if Debug['W'] != 0 {
|
||||||
s := fmt.Sprintf("\nbefore %v", Curfn.Func.Nname.Sym)
|
s := fmt.Sprintf("\nbefore %v", Curfn.Func.Nname.Sym)
|
||||||
dumpslice(s, Curfn.Nbody.Slice())
|
dumplist(s, Curfn.Nbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
lno := lineno
|
lno := lineno
|
||||||
@ -67,13 +67,13 @@ func walk(fn *Node) {
|
|||||||
walkstmtlist(Curfn.Nbody)
|
walkstmtlist(Curfn.Nbody)
|
||||||
if Debug['W'] != 0 {
|
if Debug['W'] != 0 {
|
||||||
s := fmt.Sprintf("after walk %v", Curfn.Func.Nname.Sym)
|
s := fmt.Sprintf("after walk %v", Curfn.Func.Nname.Sym)
|
||||||
dumpslice(s, Curfn.Nbody.Slice())
|
dumplist(s, Curfn.Nbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
heapmoves()
|
heapmoves()
|
||||||
if Debug['W'] != 0 && len(Curfn.Func.Enter.Slice()) > 0 {
|
if Debug['W'] != 0 && len(Curfn.Func.Enter.Slice()) > 0 {
|
||||||
s := fmt.Sprintf("enter %v", Curfn.Func.Nname.Sym)
|
s := fmt.Sprintf("enter %v", Curfn.Func.Nname.Sym)
|
||||||
dumpslice(s, Curfn.Func.Enter.Slice())
|
dumplist(s, Curfn.Func.Enter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2963,7 +2963,7 @@ func walkappend(n *Node, init nodesOrNodeListPtr, dst *Node) *Node {
|
|||||||
nx = Nod(OINDEX, ns, nn) // s[n] ...
|
nx = Nod(OINDEX, ns, nn) // s[n] ...
|
||||||
nx.Bounded = true
|
nx.Bounded = true
|
||||||
l = append(l, Nod(OAS, nx, it.N())) // s[n] = arg
|
l = append(l, Nod(OAS, nx, it.N())) // s[n] = arg
|
||||||
if it.Len() != 0 {
|
if it.Len() > 1 {
|
||||||
l = append(l, Nod(OAS, nn, Nod(OADD, nn, Nodintconst(1)))) // n = n + 1
|
l = append(l, Nod(OAS, nn, Nod(OADD, nn, Nodintconst(1)))) // n = n + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user