Commit 298be61f authored by David Chase's avatar David Chase

cmd/compile: add json logging for escape analysis

Change-Id: I7ca075e50d144aa449a20ebfbaf7337406e1e510
Reviewed-on: https://go-review.googlesource.com/c/go/+/204161
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
parent 46c9fd03
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package gc package gc
import ( import (
"cmd/compile/internal/logopt"
"cmd/compile/internal/types" "cmd/compile/internal/types"
"fmt" "fmt"
"math" "math"
...@@ -1379,9 +1380,14 @@ func (e *Escape) finish(fns []*Node) { ...@@ -1379,9 +1380,14 @@ func (e *Escape) finish(fns []*Node) {
// Update n.Esc based on escape analysis results. // Update n.Esc based on escape analysis results.
if loc.escapes { if loc.escapes {
if Debug['m'] != 0 && n.Op != ONAME { if n.Op != ONAME {
if Debug['m'] != 0 {
Warnl(n.Pos, "%S escapes to heap", n) Warnl(n.Pos, "%S escapes to heap", n)
} }
if logopt.Enabled() {
logopt.LogOpt(n.Pos, "escape", "escape", e.curfn.funcname())
}
}
n.Esc = EscHeap n.Esc = EscHeap
addrescapes(n) addrescapes(n)
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment