RFR: 8372738: ZGC: C2 allocation reloc promotion deopt race [v2]
Erik Österlund
eosterlund at openjdk.org
Tue Dec 2 14:15:19 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.
Erik Österlund has updated the pull request incrementally with one additional commit since the last revision:
StefanK comments
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/28558/files
- new: https://git.openjdk.org/jdk/pull/28558/files/e0bf6f4e..5cabcf6f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=28558&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=28558&range=00-01
Stats: 29 lines in 5 files changed: 12 ins; 9 del; 8 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