RFR: 8360775: Fix Shenandoah GC test failures when APX is enabled
Jatin Bhateja
jbhateja at openjdk.org
Mon Jun 30 09:28:41 UTC 2025
On Fri, 27 Jun 2025 00:02:08 GMT, Srinivas Vamsi Parasa <sparasa at openjdk.org> wrote:
> This PR fixes the test failures seen in many JTreg tests related to Shenandoah GC (`test/hotspot/jtreg/gc/shenandoah/`) with UseAPX. The issues were root caused to:
>
> 1. Higher band registers are not saved and restored in Shenandoah load_reference_barrier.
> 2. Pusha/Popa implementation using push2p/pop2p
>
> Both the issues are fixed in this PR.
src/hotspot/cpu/x86/assembler_x86.cpp line 15675:
> 15673: void Assembler::pusha_uncached() { // 64bit
> 15674: if (UseAPX) {
> 15675: // Data being pushed by PUSH2 must be 16B-aligned on the stack, for this push rax upfront
Hi @vamsi-parasa ,
PUSHA / POPA assembler is agnostic to the use of hardcoded registers in calling context, e.g. in following line of code
https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp#L495
If dst and tmp1 are RAX then we endup currpting it since RAX is used as a scratch register for stack alignment, and in case RAX holds an oop pointer then we may see random crashes. Such idioms are limited to GC barreirs currently, and we have recently fixed one such issue in https://github.com/openjdk/jdk/pull/25351
While the instruction sequence of PUSHA/ POPA with PPX hints is correct, Do you think for the time being we should limit the scope of this fix to save_machine_state and restor_machine_state routines rather than making generic fix in pusha/popa ?
I have tried it and it's working.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26009#discussion_r2174631978
More information about the shenandoah-dev
mailing list