]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: rearrange framepointer check condition
authorAustin Clements <austin@google.com>
Tue, 3 Feb 2015 14:18:15 +0000 (09:18 -0500)
committerAustin Clements <austin@google.com>
Tue, 3 Feb 2015 14:37:24 +0000 (14:37 +0000)
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>
src/runtime/traceback.go

index 4f63502e85cbb3894c026743fbcd2beb6deda912..6c87d7e2e4581a4d26366afd1aeef2da8dfeb0a5 100644 (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
                }