cmd/compile: change Node.Nbody, Func.Inl from *NodeList to Nodes

Passes toolstash -cmp.

Casual timings show about a 3% improvement in compile times.

Update #14473.

Change-Id: I584add2e8f1a52486ba418b25ba6122b7347b643
Reviewed-on: https://go-review.googlesource.com/19989
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-02-27 14:31:33 -08:00
parent 75cc05fa55
commit 1d5001afef
24 changed files with 525 additions and 327 deletions

View file

@ -358,7 +358,7 @@ func compile(fn *Node) {
var nam *Node
var gcargs *Sym
var gclocals *Sym
if fn.Nbody == nil {
if len(fn.Nbody.Slice()) == 0 {
if pure_go != 0 || strings.HasPrefix(fn.Func.Nname.Sym.Name, "init.") {
Yyerror("missing function body for %q", fn.Func.Nname.Sym.Name)
goto ret
@ -385,7 +385,7 @@ func compile(fn *Node) {
if t.Nname != nil {
n = Nod(OAS, t.Nname, nil)
typecheck(&n, Etop)
Curfn.Nbody = concat(list1(n), Curfn.Nbody)
Curfn.Nbody.Set(append([]*Node{n}, Curfn.Nbody.Slice()...))
}
t = structnext(&save)
@ -472,7 +472,7 @@ func compile(fn *Node) {
}
Genslice(Curfn.Func.Enter.Slice())
Genlist(Curfn.Nbody)
Genslice(Curfn.Nbody.Slice())
gclean()
checklabels()
if nerrors != 0 {