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

runtime: fix ppc64le race code

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>
This commit is contained in:
Keith Randall 2019-09-25 13:24:54 -07:00 committed by Keith Randall
parent 6232dadc63
commit 44e752c38a

View 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