]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove -newescape flag
authorMatthew Dempsky <mdempsky@google.com>
Thu, 25 Jul 2019 19:40:02 +0000 (12:40 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 28 Aug 2019 19:27:30 +0000 (19:27 +0000)
Drops support for old escape analysis pass. Subsequent, separate CL
will remove dead code.

While here, fix a minor error in fmt.go: it was still looking for
esc.go's NodeEscState in n.Opt() rather than escape.go's EscLocation.
But this only affected debug diagnostics printed during escape
analysis itself.

Change-Id: I62512e1b31c75ba0577550a5fd7824abc3159ed5
Reviewed-on: https://go-review.googlesource.com/c/go/+/187597
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/fmt.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/subr.go

index c42f25e104651e33daba18415d69108de8eb0c16..feb2d9b5dcf63ef86f0fcb24ef58252c16f110dd 100644 (file)
@@ -41,19 +41,8 @@ import (
 // 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 (
index 72b1e35b6aea9c648bf999c68d0011d59a020968..782e4cb8405645da55f163a80d6f3d01f3cc7c72 100644 (file)
@@ -457,8 +457,8 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) {
                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 {
index 2a1fd8e4fa55e9391c78e6c669dea36cd5b58aa4..db1f9d20e4a7acea08d28e097582fdebde860cdb 100644 (file)
@@ -263,7 +263,6 @@ func Main(archInit func(*Arch)) {
        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)
@@ -271,7 +270,7 @@ func Main(archInit func(*Arch)) {
        // 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
index 42f47bb8c1990cd452d26bee47298a77ad9269cf..dca9772ead629337a737266313fbccb06fdceb7e 100644 (file)
@@ -1579,7 +1579,7 @@ func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym) {
        if rcvr.IsPtr() && rcvr.Elem() == method.Type.Recv().Type && rcvr.Elem().Sym != nil {
                inlcalls(fn)
        }
-       escapeImpl()([]*Node{fn}, false)
+       escapeFuncs([]*Node{fn}, false)
 
        Curfn = nil
        funccompile(fn)