build: enable framepointer mode by default

This has a minor performance cost, but far less than is being gained by SSA.
As an experiment, enable it during the Go 1.7 beta.
Having frame pointers on by default makes Linux's perf, Intel VTune,
and other profilers much more useful, because it lets them gather a
stack trace efficiently on profiling events.
(It doesn't help us that much, since when we walk the stack we usually
need to look up PC-specific information as well.)

Fixes #15840.

Change-Id: I4efd38412a0de4a9c87b1b6e5d11c301e63f1a2a
Reviewed-on: https://go-review.googlesource.com/23451
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Russ Cox 2016-05-25 14:37:43 -04:00
parent 2168f2a68b
commit 7fdec6216c
13 changed files with 46 additions and 29 deletions

View file

@ -13,7 +13,7 @@ import (
// go-specific code shared across loaders (5l, 6l, 8l).
var (
Framepointer_enabled int
framepointer_enabled int
Fieldtrack_enabled int
)
@ -26,14 +26,21 @@ var exper = []struct {
val *int
}{
{"fieldtrack", &Fieldtrack_enabled},
{"framepointer", &Framepointer_enabled},
{"framepointer", &framepointer_enabled},
}
func addexp(s string) {
// Could do general integer parsing here, but the runtime copy doesn't yet.
v := 1
name := s
if len(name) > 2 && name[:2] == "no" {
v = 0
name = name[2:]
}
for i := 0; i < len(exper); i++ {
if exper[i].name == s {
if exper[i].name == name {
if exper[i].val != nil {
*exper[i].val = 1
*exper[i].val = v
}
return
}
@ -44,6 +51,7 @@ func addexp(s string) {
}
func init() {
framepointer_enabled = 1 // default
for _, f := range strings.Split(goexperiment, ",") {
if f != "" {
addexp(f)
@ -51,6 +59,10 @@ func init() {
}
}
func Framepointer_enabled(goos, goarch string) bool {
return framepointer_enabled != 0 && goarch == "amd64" && goos != "nacl"
}
func Nopout(p *Prog) {
p.As = ANOP
p.Scond = 0