RFR: 8309209: C2 failed "assert(_stack_guard_state == stack_guard_reserved_disabled) failed: inconsistent state"

Martin Doerr mdoerr at openjdk.org
Tue Jun 27 10:54:02 UTC 2023


On Tue, 27 Jun 2023 06:12:47 GMT, David Holmes <dholmes at openjdk.org> wrote:

> This appears to be the same kind of issue as reported in [JDK-8146697](https://bugs.openjdk.org/browse/JDK-8146697) way back in Java 9, which was only "fixed" on x86.  The current failure was seen on Aarch64. It seems prudent to apply the same changes to all the other platforms. I've done Aarch64, and took a guess at RISC-V but do not know PPC or S390, so I am looking to others to provide the appropriate equivalent code changes there.
> 
> Testing so far is Aarch64 only:
> - Tiers 1-3
> - 50x the closed stackoverflow test that failed previously
> - 25x vmTestbase/nsk/stress/stack/*
> 
> As these failures are so rare, passing tests don't really tell us much. This is more an attempt at additional robustness.
> 
> Thanks.

PPC64 implementation:

--- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
+++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
@@ -888,6 +888,11 @@ void InterpreterMacroAssembler::remove_activation(TosState state,
     // Test if reserved zone needs to be enabled.
     Label no_reserved_zone_enabling;
 
+    // check if already enabled - if so no re-enabling needed
+    lwz(R0, in_bytes(JavaThread::stack_guard_state_offset()), R16_thread);
+    cmpwi(CCR0, R0, StackOverflow::stack_guard_enabled);
+    beq_predict_taken(CCR0, no_reserved_zone_enabling);
+
     // Compare frame pointers. There is no good stack pointer, as with stack
     // frame compression we can get different SPs when we do calls. A subsequent
     // call could have a smaller SP, so that this compare succeeds for an


Is the RISCV version correct? `StackGuardState` is an `enum` and should typically have 4 Bytes.

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

PR Comment: https://git.openjdk.org/jdk/pull/14669#issuecomment-1609261546


More information about the hotspot-compiler-dev mailing list