diff options
| author | Keith Randall <khr@golang.org> | 2022-11-01 16:46:43 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2023-02-24 00:21:13 +0000 |
| commit | 21d82e6ac80fc2aea1eac9c8eec9afdd79cb5bdd (patch) | |
| tree | 293b975ed4dc782a0d68ab64dc6167b6d6486066 /src/runtime/asm_ppc64x.s | |
| parent | f684f3dc434f9199ceee175c07d28e8b2b0f28dc (diff) | |
| download | go-21d82e6ac80fc2aea1eac9c8eec9afdd79cb5bdd.tar.xz | |
cmd/compile: batch write barrier calls
Have the write barrier call return a pointer to a buffer into which
the generated code records pointers that need write barrier treatment.
Change-Id: I7871764298e0aa1513de417010c8d46b296b199e
Reviewed-on: https://go-review.googlesource.com/c/go/+/447781
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Bypass: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/asm_ppc64x.s')
| -rw-r--r-- | src/runtime/asm_ppc64x.s | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index 0f6421f6f5..37472c0f79 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -928,15 +928,15 @@ TEXT ·checkASM(SB),NOSPLIT,$0-1 MOVB R3, ret+0(FP) RET -// gcWriteBarrier performs a heap pointer write and informs the GC. +// gcWriteBarrier informs the GC about heap pointer writes. // -// gcWriteBarrier does NOT follow the Go ABI. It takes two arguments: -// - R20 is the destination of the write -// - R21 is the value being written at R20. +// gcWriteBarrier does NOT follow the Go ABI. It accepts the +// number of bytes of buffer needed in R29, and returns a pointer +// to the buffer space in R29. // It clobbers condition codes. // It does not clobber R0 through R17 (except special registers), // but may clobber any other register, *including* R31. -TEXT runtime·gcWriteBarrier<ABIInternal>(SB),NOSPLIT,$112 +TEXT gcWriteBarrier<>(SB),NOSPLIT,$112 // The standard prologue clobbers R31. // We use R18, R19, and R31 as scratch registers. retry: @@ -945,16 +945,14 @@ retry: MOVD (p_wbBuf+wbBuf_next)(R18), R19 MOVD (p_wbBuf+wbBuf_end)(R18), R31 // Increment wbBuf.next position. - ADD $16, R19 + ADD R29, R19 // Is the buffer full? CMPU R31, R19 BLT flush // Commit to the larger buffer. MOVD R19, (p_wbBuf+wbBuf_next)(R18) - // Record the write. - MOVD R21, -16(R19) // Record value - MOVD (R20), R18 // TODO: This turns bad writes into bad reads. - MOVD R18, -8(R19) // Record *slot + // Make return value (the original next position) + SUB R29, R19, R29 RET flush: @@ -998,6 +996,31 @@ flush: MOVD (FIXED_FRAME+104)(R1), R17 JMP retry +TEXT runtime·gcWriteBarrier1<ABIInternal>(SB),NOSPLIT,$0 + MOVD $8, R29 + JMP gcWriteBarrier<>(SB) +TEXT runtime·gcWriteBarrier2<ABIInternal>(SB),NOSPLIT,$0 + MOVD $16, R29 + JMP gcWriteBarrier<>(SB) +TEXT runtime·gcWriteBarrier3<ABIInternal>(SB),NOSPLIT,$0 + MOVD $24, R29 + JMP gcWriteBarrier<>(SB) +TEXT runtime·gcWriteBarrier4<ABIInternal>(SB),NOSPLIT,$0 + MOVD $32, R29 + JMP gcWriteBarrier<>(SB) +TEXT runtime·gcWriteBarrier5<ABIInternal>(SB),NOSPLIT,$0 + MOVD $40, R29 + JMP gcWriteBarrier<>(SB) +TEXT runtime·gcWriteBarrier6<ABIInternal>(SB),NOSPLIT,$0 + MOVD $48, R29 + JMP gcWriteBarrier<>(SB) +TEXT runtime·gcWriteBarrier7<ABIInternal>(SB),NOSPLIT,$0 + MOVD $56, R29 + JMP gcWriteBarrier<>(SB) +TEXT runtime·gcWriteBarrier8<ABIInternal>(SB),NOSPLIT,$0 + MOVD $64, R29 + JMP gcWriteBarrier<>(SB) + // Note: these functions use a special calling convention to save generated code space. // Arguments are passed in registers, but the space for those arguments are allocated // in the caller's stack frame. These stubs write the args into that stack space and |
