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

Fei Yang fyang at openjdk.org
Tue Jun 27 09:23:03 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.

Changes requested by fyang (Reviewer).

src/hotspot/cpu/riscv/interp_masm_riscv.cpp line 770:

> 768:     ld(t0, Address(rthread, JavaThread::stack_guard_state_offset()));
> 769:     beq(t0, StackOverflow::stack_guard_enabled, no_reserved_zone_enabling);
> 770: 

Hi, Thanks for handling RISC-V. But this won't build on RISC-V. We would need something like:


diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp
index edec2e08c83..99906c0fea6 100644
--- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp
+++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp
@@ -764,6 +764,11 @@ void InterpreterMacroAssembler::remove_activation(
     // testing if reserved zone needs to be re-enabled
     Label no_reserved_zone_enabling;

+    // check if already enabled - if so no re-enabling needed
+    ld(t0, Address(xthread, JavaThread::stack_guard_state_offset()));
+    sub(t0, t0, StackOverflow::stack_guard_enabled);
+    beqz(t0, no_reserved_zone_enabling);
+
     ld(t0, Address(xthread, JavaThread::reserved_stack_activation_offset()));
     ble(t1, t0, no_reserved_zone_enabling);

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

PR Review: https://git.openjdk.org/jdk/pull/14669#pullrequestreview-1500358057
PR Review Comment: https://git.openjdk.org/jdk/pull/14669#discussion_r1243413208


More information about the hotspot-compiler-dev mailing list