1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:30:04 -07:00

runtime: rearrange framepointer check condition

The test for the framepointer experiment flag is cheaper and more
branch-predictable than the other parts of this conditional, so move
it first.  This is also more readable.

(Originally, the flag check required parsing the experiments string,
which is why it was done last.  Now that flag is cached.)

Change-Id: I84e00fa7e939e9064f0fa0a4a6fe00576dd61457
Reviewed-on: https://go-review.googlesource.com/3782
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Austin Clements 2015-02-03 09:18:15 -05:00
parent 67a03fd6a2
commit fc5baec37f

View File

@ -234,7 +234,7 @@ func gentraceback(pc0 uintptr, sp0 uintptr, lr0 uintptr, gp *g, skip int, pcbuf
// If framepointer_enabled and there's a frame, then
// there's a saved bp here.
if GOARCH == "amd64" && frame.varp > frame.sp && framepointer_enabled {
if framepointer_enabled && GOARCH == "amd64" && frame.varp > frame.sp {
frame.varp -= regSize
}