RFR: JDK-8274795: AArch64: avoid spilling and restoring r18 in macro assembler [v2]
Bernhard Urban-Forster
burban at openjdk.java.net
Wed Oct 6 13:44:09 UTC 2021
On Wed, 6 Oct 2021 09:26:35 GMT, Andrew Haley <aph at openjdk.org> wrote:
> Sorry, stupid mistake: the pop is done in reverse, of course!
hmm, I think it's fine. Checkout the full listing:
0x0000000130009f80: b.ne 0x000000013000a018 // b.any
0x0000000130009f84: stp x0, x1, [sp, #-256]!
0x0000000130009f88: stp x2, x3, [sp, #16]
0x0000000130009f8c: stp x4, x5, [sp, #32]
0x0000000130009f90: stp x6, x7, [sp, #48]
0x0000000130009f94: stp x8, x9, [sp, #64]
0x0000000130009f98: stp x10, x11, [sp, #80]
0x0000000130009f9c: stp x12, x13, [sp, #96]
0x0000000130009fa0: stp x14, x15, [sp, #112]
0x0000000130009fa4: stp x16, x17, [sp, #128]
0x0000000130009fa8: stp x18, x19, [sp, #144]
0x0000000130009fac: stp x20, x21, [sp, #160]
0x0000000130009fb0: stp x22, x23, [sp, #176]
0x0000000130009fb4: stp x24, x25, [sp, #192]
0x0000000130009fb8: stp x26, x27, [sp, #208]
0x0000000130009fbc: stp x28, x29, [sp, #224]
0x0000000130009fc0: stp x30, xzr, [sp, #240]
0x0000000130009fc4: mov x0, x28
;; 0x10564AC0C
0x0000000130009fc8: mov x9, #0xac0c // #44044
0x0000000130009fcc: movk x9, #0x564, lsl #16
0x0000000130009fd0: movk x9, #0x1, lsl #32
0x0000000130009fd4: blr x9
0x0000000130009fd8: ldp x2, x3, [sp, #16]
0x0000000130009fdc: ldp x4, x5, [sp, #32]
0x0000000130009fe0: ldp x6, x7, [sp, #48]
0x0000000130009fe4: ldp x8, x9, [sp, #64]
0x0000000130009fe8: ldp x10, x11, [sp, #80]
0x0000000130009fec: ldp x12, x13, [sp, #96]
0x0000000130009ff0: ldp x14, x15, [sp, #112]
0x0000000130009ff4: ldp x16, x17, [sp, #128]
0x0000000130009ff8: ldp x0, x1, [sp], #144
0x0000000130009ffc: ldp xzr, x19, [sp], #16
0x000000013000a000: ldp x22, x23, [sp, #16]
0x000000013000a004: ldp x24, x25, [sp, #32]
0x000000013000a008: ldp x26, x27, [sp, #48]
0x000000013000a00c: ldp x28, x29, [sp, #64]
0x000000013000a010: ldp x30, xzr, [sp, #80]
0x000000013000a014: ldp x20, x21, [sp], #96
0x000000013000a018: ldur x12, [x29, #-24]
0x000000013000a01c: ldr x22, [x12, #16]
0x000000013000a020: add x22, x22, #0x30
0x000000013000a024: ldr x8, [x28, #8]
In terms of testing, it seems hard to trigger, so I forced the code path via:
diff --git a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
index d069345b9c0..046c325faa7 100644
--- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
@@ -1392,11 +1392,14 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
{
Label no_reguard;
+ Label skip_check;
+ __ b(skip_check);
__ lea(rscratch1, Address(rthread, in_bytes(JavaThread::stack_guard_state_offset())));
__ ldrw(rscratch1, Address(rscratch1));
__ cmp(rscratch1, (u1)StackOverflow::stack_guard_yellow_reserved_disabled);
__ br(Assembler::NE, no_reguard);
+ __ bind(skip_check);
__ push(RegSet::range(r0, r30), sp);
__ mov(c_rarg0, rthread);
__ mov(rscratch2, CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages));
which crashes with your most recent suggestion btw, but it's fine with what's in this PR right now.
Any better suggestion on how to test it?
-------------
PR: https://git.openjdk.java.net/jdk/pull/5828
More information about the hotspot-dev
mailing list