diff options
| author | Russ Cox <rsc@golang.org> | 2016-05-25 14:37:43 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2016-05-26 19:02:00 +0000 |
| commit | 7fdec6216c0a25c6dbcc8159b755da6682dd9080 (patch) | |
| tree | bf489c761706e04d64ef73675ceb805c4b30a3c4 /src/runtime | |
| parent | 2168f2a68bb438996d14869ff7dd10a47cc0552c (diff) | |
| download | go-7fdec6216c0a25c6dbcc8159b755da6682dd9080.tar.xz | |
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>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/proc.go | 9 | ||||
| -rw-r--r-- | src/runtime/runtime2.go | 3 | ||||
| -rw-r--r-- | src/runtime/stack.go | 3 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index ee89547104..727c991a57 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -434,9 +434,6 @@ func schedinit() { sched.maxmcount = 10000 - // Cache the framepointer experiment. This affects stack unwinding. - framepointer_enabled = haveexperiment("framepointer") - tracebackinit() moduledataverify() stackinit() @@ -4163,6 +4160,9 @@ func setMaxThreads(in int) (out int) { } func haveexperiment(name string) bool { + if name == "framepointer" { + return framepointer_enabled // set by linker + } x := sys.Goexperiment for x != "" { xname := "" @@ -4175,6 +4175,9 @@ func haveexperiment(name string) bool { if xname == name { return true } + if len(xname) > 2 && xname[:2] == "no" && xname[2:] == name { + return false + } } return false } diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 71da504f1c..6119e75203 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -725,7 +725,8 @@ var ( support_avx bool support_avx2 bool - goarm uint8 // set by cmd/link on arm systems + goarm uint8 // set by cmd/link on arm systems + framepointer_enabled bool // set by cmd/link ) // Set by the linker so the runtime can determine the buildmode. diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 33d29f19a8..8e344cdf03 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -155,9 +155,6 @@ var stackLarge struct { free [_MHeapMap_Bits]mSpanList // free lists by log_2(s.npages) } -// Cached value of haveexperiment("framepointer") -var framepointer_enabled bool - func stackinit() { if _StackCacheSize&_PageMask != 0 { throw("cache size must be a multiple of page size") |
