Skip to content

Commit

Permalink
cmd/compile: respect -newescape in genwrapper
Browse files Browse the repository at this point in the history
Noticed while preparing a CL for Go 1.14 to remove esc.go.

Change-Id: Ic12be33f5b16c8424d85f373fa450247be086078
Reviewed-on: https://go-review.googlesource.com/c/go/+/173298
Run-TryBot: Matthew Dempsky <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Cherry Zhang <[email protected]>
  • Loading branch information
mdempsky committed Apr 23, 2019
1 parent f0fdbb1 commit a152dd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/cmd/compile/internal/gc/esc.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ import (
var newescape bool

func escapes(all []*Node) {
esc := escAnalyze
visitBottomUp(all, escapeImpl())
}

func escapeImpl() func([]*Node, bool) {
if newescape {
esc = escapeFuncs
return escapeFuncs
}
visitBottomUp(all, esc)
return escAnalyze
}

const (
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/gc/subr.go
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,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)
}
escAnalyze([]*Node{fn}, false)
escapeImpl()([]*Node{fn}, false)

Curfn = nil
funccompile(fn)
Expand Down

0 comments on commit a152dd0

Please sign in to comment.