]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix ppc64le race code
authorKeith Randall <khr@google.com>
Wed, 25 Sep 2019 20:24:54 +0000 (13:24 -0700)
committerKeith Randall <khr@golang.org>
Wed, 25 Sep 2019 21:39:33 +0000 (21:39 +0000)
This code is not currently compiling, the asm vet checks fail. When running race.bash on ppc64le, I get:

runtime/race_ppc64le.s:104:1: [ppc64le] RaceReadRange: wrong argument size 24; expected $...-16
runtime/race_ppc64le.s:514:1: [ppc64le] racecallbackthunk: unknown variable cmd; offset 0 is arg+0(FP)
runtime/race_ppc64le.s:515:1: [ppc64le] racecallbackthunk: unknown variable ctx

I'm also not sure why it ever worked; it looks like it is writing
the arguments to racecallback in the wrong place (the race detector
itself probably still works, it would just have trouble symbolizing
any resulting race report).

At a meta-level, we should really add a ppc64le/race builder.
Otherwise this code will rot, as evidenced by the rot this CL fixes :)

Update #33309

Change-Id: I3b49c2442aa78538fbb631a143a757389a1368fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/197337
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/race_ppc64le.s

index 79b8ba2ae86f4717f8dc75cbcab6a40ee8c17926..0486bb338be02fcec09c6cbad744756d5dc08c72 100644 (file)
@@ -8,6 +8,7 @@
 #include "go_tls.h"
 #include "funcdata.h"
 #include "textflag.h"
+#include "asm_ppc64x.h"
 
 // The following functions allow calling the clang-compiled race runtime directly
 // from Go code without going all the way through cgo.
@@ -101,7 +102,7 @@ TEXT        runtime·racereadrangepc1(SB), NOSPLIT, $0-24
        MOVD    $__tsan_read_range(SB), R8
        BR      racecalladdr<>(SB)
 
-TEXT    runtime·RaceReadRange(SB), NOSPLIT, $0-24
+TEXT    runtime·RaceReadRange(SB), NOSPLIT, $0-16
        BR      runtime·racereadrange(SB)
 
 // func runtime·RaceWriteRange(addr, size uintptr)
@@ -467,9 +468,9 @@ rest:
        MOVD    R10, 16(R1)
        MOVW    CR, R10
        MOVW    R10, 8(R1)
-       MOVDU   R1, -336(R1) // Allocate frame needed for register save area
+       MOVDU   R1, -336(R1) // Allocate frame needed for outargs and register save area
 
-       MOVD    R14, 40(R1)
+       MOVD    R14, 328(R1)
        MOVD    R15, 48(R1)
        MOVD    R16, 56(R1)
        MOVD    R17, 64(R1)
@@ -511,8 +512,8 @@ rest:
 
        MOVD    g_m(g), R7
        MOVD    m_g0(R7), g // set g = m-> g0
-       MOVD    R3, cmd+0(FP) // can't use R1 here ?? use input args and assumer caller expects those?
-       MOVD    R4, ctx+8(FP) // can't use R1 here ??
+       MOVD    R3, FIXED_FRAME+0(R1)
+       MOVD    R4, FIXED_FRAME+8(R1)
        BL      runtime·racecallback(SB)
        // All registers are clobbered after Go code, reload.
        MOVD    runtime·tls_g(SB), R10
@@ -520,7 +521,7 @@ rest:
 
        MOVD    g_m(g), R7
        MOVD    m_curg(R7), g // restore g = m->curg
-       MOVD    40(R1), R14
+       MOVD    328(R1), R14
        MOVD    48(R1), R15
        MOVD    56(R1), R16
        MOVD    64(R1), R17