compiler: Escape analysis.
By Chris Manghane.
Comprises three changes to gofrontend repository:
compiler: Add escape information to export data.
compiler: Stack-allocate non-escaping variables.
This change allows variables initialized through make or new
to be allocated on the stack via a temporary variable if they
do not escape their function. It also improves the analysis to
consider situations where variables escape in the standard
library and go testsuite such as:
*nested composite literals and composite literal arguments
*method receivers always escaping
*escape via statements in closures referring to enclosing variables
*escape via calls with multiple return results
compiler: Basic escape analysis for the go frontend.
This is an implementation of the algorithm described in
"Escape Analysis in Java" by Choi et. al.
It relies on dataflow information to discover variable
references to one another. Handles assignments to closures
and association between closures variables and the variables
of the enclosing scope.
Dataflow analysis does not discover references through range
statements e.g. for _, v := range a will not recognize that
all values of v are references to a.
* Make-lang.in (GO_OBJS): Add go/escape.o.
From-SVN: r222188
17 files changed: