mirror of
https://github.com/golang/go
synced 2024-11-17 02:54:45 -07:00
runtime: save some stack space for racecall on ARM64
To avoid nosplit overflow in -race -N -l build. For #51247. Change-Id: I48426bbd4adefd18eaf26ed51b4113c6a28305b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/386716 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
d93cc8cb96
commit
d27248c52f
@ -396,12 +396,12 @@ racecallatomic_ignore:
|
||||
// Addr is outside the good range.
|
||||
// Call __tsan_go_ignore_sync_begin to ignore synchronization during the atomic op.
|
||||
// An attempt to synchronize on the address would cause crash.
|
||||
MOVD R9, R20 // remember the original function
|
||||
MOVD R9, R21 // remember the original function
|
||||
MOVD $__tsan_go_ignore_sync_begin(SB), R9
|
||||
load_g
|
||||
MOVD g_racectx(g), R0 // goroutine context
|
||||
BL racecall<>(SB)
|
||||
MOVD R20, R9 // restore the original function
|
||||
MOVD R21, R9 // restore the original function
|
||||
// Call the atomic function.
|
||||
// racecall will call LLVM race code which might clobber R28 (g)
|
||||
load_g
|
||||
@ -428,10 +428,12 @@ TEXT runtime·racecall(SB), NOSPLIT, $0-0
|
||||
JMP racecall<>(SB)
|
||||
|
||||
// Switches SP to g0 stack and calls (R9). Arguments already set.
|
||||
TEXT racecall<>(SB), NOSPLIT, $0-0
|
||||
// Clobbers R19, R20.
|
||||
TEXT racecall<>(SB), NOSPLIT|NOFRAME, $0-0
|
||||
MOVD g_m(g), R10
|
||||
// Switch to g0 stack.
|
||||
MOVD RSP, R19 // callee-saved, preserved across the CALL
|
||||
MOVD R30, R20 // callee-saved, preserved across the CALL
|
||||
MOVD m_g0(R10), R11
|
||||
CMP R11, g
|
||||
BEQ call // already on g0
|
||||
@ -440,7 +442,7 @@ TEXT racecall<>(SB), NOSPLIT, $0-0
|
||||
call:
|
||||
BL R9
|
||||
MOVD R19, RSP
|
||||
RET
|
||||
JMP (R20)
|
||||
|
||||
// C->Go callback thunk that allows to call runtime·racesymbolize from C code.
|
||||
// Direct Go->C race call has only switched SP, finish g->g0 switch by setting correct g.
|
||||
|
Loading…
Reference in New Issue
Block a user