]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: relax address-of escape analysis
authorRuss Cox <rsc@golang.org>
Fri, 14 Feb 2014 00:59:09 +0000 (19:59 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 14 Feb 2014 00:59:09 +0000 (19:59 -0500)
commite5d742fcadf9677a40336d6cecd3ff464a94730f
treee80d5a62d349f9a3d3ca6509dec8e45a260a4f7d
parente0bb5ba52cff479f70d4351d3fafa35e1655839b
cmd/gc: relax address-of escape analysis

Make the loop nesting depth of &x depend on where x is declared,
not on where the &x appears. The latter is only a conservative
estimate of the former. Being more careful can avoid some
variables escaping, and it is easier to reason about.

It would have avoided issue 7313, although that was still a bug
worth fixing.

Not much effect in the tree: one variable in the whole tree
is saved from a heap allocation (something in x509 parsing).

LGTM=daniel.morsing
R=daniel.morsing
CC=golang-codereviews
https://golang.org/cl/62380043
src/cmd/gc/esc.c
test/escape2.go