]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/gc: move check for large-hence-heap-allocated types into escape analysis
authorDavid Chase <drchase@google.com>
Wed, 20 May 2015 19:16:34 +0000 (15:16 -0400)
committerDavid Chase <drchase@google.com>
Fri, 22 May 2015 02:13:54 +0000 (02:13 +0000)
commite5060c7f7524bf32e07f62d2593aae8d280725e5
tree7efca0287fca9550dd5f886d64fc164f99da241b
parentb19ec6842d3d3bdc6d7b67fa065121a9d317cff7
cmd/internal/gc: move check for large-hence-heap-allocated types into escape analysis

Before this change, the check for too-large arrays (and other large
types) occurred after escape analysis.  If the data moved off stack
and onto the heap contained any pointers, it would therefore escape,
but because the too-large check occurred after escape analysis this
would not be recorded and a stack pointer would leak to the heap
(see the modified escape_array.go for an example).

Some of these appear to remain, in calls to typecheck from within walk.

Also corrected a few comments in escape_array.go about "BAD"
analysis that is now done correctly.

Enhanced to move aditional EscNone-but-large-so-heap checks into esc.c.

Change-Id: I770c111baff28a9ed5f8beb601cf09dacc561b83
Reviewed-on: https://go-review.googlesource.com/10268
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/walk.go
test/escape5.go
test/escape_array.go