proc: auto-dereference local variables that escape to the heap

The compiler a variable 'v' that escapes to the heap with a '&v' entry.
Auto dereference those local variables.

Fixe #871
This commit is contained in:
aarzilli
2017-06-13 10:38:45 +02:00
committed by Derek Parker
parent 2079562b25
commit 317ebe1c58
2 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,11 @@ type VariableFlags uint16
const ( const (
// VariableEscaped is set for local variables that escaped to the heap // VariableEscaped is set for local variables that escaped to the heap
//
// The compiler performs escape analysis on local variables, the variables
// that may outlive the stack frame are allocated on the heap instead and
// only the address is recorded on the stack. These variables will be
// marked with this flag.
VariableEscaped VariableFlags = (1 << iota) VariableEscaped VariableFlags = (1 << iota)
// VariableShadowed is set for local variables that are shadowed by a // VariableShadowed is set for local variables that are shadowed by a
// variable with the same name in another scope // variable with the same name in another scope

View File

@ -152,6 +152,11 @@ type VariableFlags uint16
const ( const (
// VariableEscaped is set for local variables that escaped to the heap // VariableEscaped is set for local variables that escaped to the heap
//
// The compiler performs escape analysis on local variables, the variables
// that may outlive the stack frame are allocated on the heap instead and
// only the address is recorded on the stack. These variables will be
// marked with this flag.
VariableEscaped = VariableFlags(proc.VariableEscaped) VariableEscaped = VariableFlags(proc.VariableEscaped)
// VariableShadowed is set for local variables that are shadowed by a // VariableShadowed is set for local variables that are shadowed by a