RFR: 8357954: G1: No SATB barriers applied for runtime IN_NATIVE atomics

Thomas Schatzl tschatzl at openjdk.org
Mon Jun 2 09:56:53 UTC 2025


On Mon, 2 Jun 2025 08:19:48 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:

> OopHandle has had atomic xchg/cmpxchg operations added to it. Yet, the G1 access API backend doesn't really support that; there is no SATB barrier.
> 
> Fortunately the only use of OopHandle::xchg so far is appending to the pending list, which didn't need SATB barriers because young generation reference processing only adds young objects that the old gen doesn't care much about, and the old gen reference processor doesn't care about its own References that it publishes, because it's done after marking.
> 
> And fortunately the only use of OopHandle::cmpxchg so far is manipulating a lock-free list of virtual threads to unblock in JVM_TakeVirtualThreadListToUnblock. Since the virtual threads are blocked, they are externally kept alive.
> 
> But it's starting to feel quite scary, so let's be proactive and add the support to G1 before something inevitably blows up. This patch adds the missing SATB keep-alive code for G1 IN_NATIVE oop atomics.

Marked as reviewed by tschatzl (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/25576#pullrequestreview-2887612023


More information about the hotspot-gc-dev mailing list