RFR: 8357267: ZGC: Handle APX EGPRs spilling in ZRuntimeCallSpill

Sandhya Viswanathan sviswanathan at openjdk.org
Wed May 21 22:31:58 UTC 2025


On Wed, 21 May 2025 12:33:26 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> Patch spills APX EGPRs across runtime calls to slow-path barriers using PUSH2P/POP2 instructions with PPX hints.
> These instructions operate over a pair of registers resulting into an smaller save/restoration JIT code, on the hind side they have hard alignment and balancing constraints, as they operate over 16-byte aligned stack address.
> ZRuntimeCallSpill is agnostic to live register, thus resulting SPILL sequence should not modify the contents of the register.
> 
> Patch has been verified using Intel SDE all test under test/hotspot/jtreg/compiler/gcbarriers are green.
> 
> Kindly review and share your feedback.
> 
> Best Regards,
> Jatin

src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp line 82:

> 80:     MacroAssembler* masm = _masm;
> 81:     if (VM_Version::supports_apx_f()) {
> 82:       __ push(rax);

if _result is not equal to rax this also could be pushp rax here and popp rax in restore().

src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp line 83:

> 81:     if (VM_Version::supports_apx_f()) {
> 82:       __ push(rax);
> 83:       __ push(rcx);

This could be __ pushp(rcx).

src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp line 92:

> 90:       // Note: For PPX to work properly, a PPX-marked PUSH2 (respectively, POP2) should always
> 91:       // be matched with a PPX-marked POP2 (PUSH2), not with two PPX-marked POPs (PUSHs).
> 92:       __ pushp(rcx);

This is saving old rsp on stack and restored using __ movptr(rsp, Address(rsp)) on the other end in restore().  So this should be __ push(rcx)  and not __ pushp(rcx) as there is no corresponding __ popp() instruction for this pushp.

src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp line 185:

> 183:       // Re-instantiate original stack pointer.
> 184:       __ movptr(rsp, Address(rsp));
> 185:       __ pop(rcx);

This could be __ popp(rcx).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25351#discussion_r2101275404
PR Review Comment: https://git.openjdk.org/jdk/pull/25351#discussion_r2101266706
PR Review Comment: https://git.openjdk.org/jdk/pull/25351#discussion_r2101264344
PR Review Comment: https://git.openjdk.org/jdk/pull/25351#discussion_r2101267521


More information about the hotspot-dev mailing list