// not escape, then new(T) can be rewritten into a stack allocation.
// The same is true of slice literals.
-// If newescape is true, then escape.go drives escape analysis instead
-// of esc.go.
-var newescape bool
-
func escapes(all []*Node) {
- visitBottomUp(all, escapeImpl())
-}
-
-func escapeImpl() func([]*Node, bool) {
- if newescape {
- return escapeFuncs
- }
- return escAnalyze
+ visitBottomUp(all, escapeFuncs)
}
const (
fmt.Fprintf(s, " esc(%d)", n.Esc)
}
- if e, ok := n.Opt().(*NodeEscState); ok && e.Loopdepth != 0 {
- fmt.Fprintf(s, " ld(%d)", e.Loopdepth)
+ if e, ok := n.Opt().(*EscLocation); ok && e.loopDepth != 0 {
+ fmt.Fprintf(s, " ld(%d)", e.loopDepth)
}
if c == 0 && n.Typecheck() != 0 {
flag.StringVar(&blockprofile, "blockprofile", "", "write block profile to `file`")
flag.StringVar(&mutexprofile, "mutexprofile", "", "write mutex profile to `file`")
flag.StringVar(&benchfile, "bench", "", "append benchmark times to `file`")
- flag.BoolVar(&newescape, "newescape", true, "enable new escape analysis")
flag.BoolVar(&smallFrames, "smallframes", false, "reduce the size limit for stack allocated objects")
flag.BoolVar(&Ctxt.UseBASEntries, "dwarfbasentries", Ctxt.UseBASEntries, "use base address selection entries in DWARF")
objabi.Flagparse(usage)
// Record flags that affect the build result. (And don't
// record flags that don't, since that would cause spurious
// changes in the binary.)
- recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "newescape", "dwarfbasentries", "smallframes")
+ recordFlags("B", "N", "l", "msan", "race", "shared", "dynlink", "dwarflocationlists", "dwarfbasentries", "smallframes")
if smallFrames {
maxStackVarSize = 128 * 1024