Integrated: 8372738: ZGC: C2 allocation reloc promotion deopt race

Erik Österlund eosterlund at openjdk.org
Wed Dec 3 09:31:53 UTC 2025


On Fri, 28 Nov 2025 15:11:07 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 3e04e114
Author:    Erik Österlund <eosterlund at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3e04e11482605e7734ef75bc477fe31107988f42
Stats:     96 lines in 8 files changed: 61 ins; 11 del; 24 mod

8372738: ZGC: C2 allocation reloc promotion deopt race

Reviewed-by: aboldtch, stefank

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

PR: https://git.openjdk.org/jdk/pull/28558


More information about the hotspot-gc-dev mailing list