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 @@
package gc
import (
"cmd/compile/internal/logopt"
"cmd/compile/internal/types"
"fmt"
"math"
......@@ -1379,8 +1380,13 @@ func (e *Escape) finish(fns []*Node) {
// Update n.Esc based on escape analysis results.
if loc.escapes {
if Debug['m'] != 0 && n.Op != ONAME {
Warnl(n.Pos, "%S escapes to heap", n)
if n.Op != ONAME {
if Debug['m'] != 0 {
Warnl(n.Pos, "%S escapes to heap", n)
}
if logopt.Enabled() {
logopt.LogOpt(n.Pos, "escape", "escape", e.curfn.funcname())
}
}
n.Esc = EscHeap
addrescapes(n)
......
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