RFR: 8372738: ZGC: C2 allocation reloc promotion deopt race
Erik Österlund
eosterlund at openjdk.org
Fri Nov 28 15:30:05 UTC 2025
In https://bugs.openjdk.org/browse/JDK-8371200 a race was handled between flip promoting objects, their promotion barriers, tenuring threshold selection and signalling to the JIT slow path allocation code to deoptimize. It made sure that flip promoted objects are made old before a handshake with the Java threads, and ran promotion barriers to erase any raw nulls after the handshake. This order was crucial to the fix.
Now unfortunately, there is a related problem for relocate promoting objects. Such objects run the promotion barriers before the object becomes old, which is the signal for the JIT allocation slow path code to deopt. Unfortunately, the order should be the opposite, similar to flip promoted objects. I propose signalling that relocate promoting pages are marked as relocate promoted during relocation set selection, and include that as a condition for deopt in the allocation slow path. The relocation set selection runs before the handshake, hence ensuring that promotion barriers won't race with JIT compiled code that has elided barriers.
T1-5 tests look good. The test that failed before reproduces an observable issue without the fix and not after the fix.
-------------
Commit messages:
- 8372738: ZGC: C2 allocation reloc promotion deopt race
Changes: https://git.openjdk.org/jdk/pull/28558/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28558&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8372738
Stats: 92 lines in 8 files changed: 58 ins; 11 del; 23 mod
Patch: https://git.openjdk.org/jdk/pull/28558.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28558/head:pull/28558
PR: https://git.openjdk.org/jdk/pull/28558
More information about the hotspot-gc-dev
mailing list