]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: change Func.{Dcl,Inldcl} from NodeList to slice
authorIan Lance Taylor <iant@golang.org>
Thu, 25 Feb 2016 18:35:19 +0000 (10:35 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 26 Feb 2016 20:43:23 +0000 (20:43 +0000)
commitb66a892358d2ca5ee7008ceeeda050d9f64ce5a2
tree345294b2f4340cf423c302eec013cd73fe27a269
parent67dbde0d7197b2fe6c9e08bda9fa4656c1f75ce4
cmd/compile: change Func.{Dcl,Inldcl} from NodeList to slice

A slice uses less memory than a NodeList, and has better memory locality
when walking the list.

This uncovered a tricky case involving closures: the escape analysis
pass when run on a closure was appending to the Dcl list of the OCLOSURE
rather than the ODCLFUNC.  This happened to work because they shared the
same NodeList.  Fixed with a change to addrescapes, and a check to
Tempname to catch any recurrences.

This removes the last use of the listsort function outside of tests.
I'll send a separate CL to remove it.

Unfortunately, while this passes all tests, it does not pass toolstash
-cmp.  The problem is that cmpstackvarlt does not fully determine the
sort order, and the change from listsort to sort.Sort, while generally
desirable, produces a different ordering.  I could stage this by first
making cmpstackvarlt fully determined, but no matter what toolstash -cmp
is going to break at some point.

In my casual testing the compiler is 2.2% faster.

Update #14473.

Change-Id: I367d66daa4ec73ed95c14c66ccda3a2133ad95d5
Reviewed-on: https://go-review.googlesource.com/19919
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
21 files changed:
src/cmd/compile/internal/amd64/ggen.go
src/cmd/compile/internal/arm/ggen.go
src/cmd/compile/internal/arm64/ggen.go
src/cmd/compile/internal/gc/cgen.go
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/gen.go
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/parser.go
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/gc/popt.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go
src/cmd/compile/internal/mips64/ggen.go
src/cmd/compile/internal/ppc64/ggen.go
src/cmd/compile/internal/x86/ggen.go