cmd/gc: allocate backing storage for non-escaping interfaces on stack

Extend escape analysis to convT2E and conT2I. If the interface value
does not escape supply runtime with a stack buffer for the object copy.

This is a straight port from .c to .go of Dmitry's patch

Change-Id: Ic315dd50d144d94dd3324227099c116be5ca70b6
Reviewed-on: https://go-review.googlesource.com/8201
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
This commit is contained in:
David Chase 2015-03-27 11:21:14 -04:00
parent cf7461caed
commit 2270133981
7 changed files with 72 additions and 13 deletions

View file

@ -653,12 +653,11 @@ func esc(e *EscState, n *Node, up *Node) {
}
}
case OCONV, OCONVNOP:
case OCONV,
OCONVNOP:
escassign(e, n, n.Left)
case OCONVIFACE:
// We don't allocate storage for OCONVIFACE on stack yet,
// but mark it as EscNone merely to get debug output for tests.
n.Esc = EscNone // until proven otherwise
e.noesc = list(e.noesc, n)
n.Escloopdepth = e.loopdepth