RFR: 8357954: G1: No SATB barriers applied for runtime IN_NATIVE atomics
Erik Österlund
eosterlund at openjdk.org
Mon Jun 2 08:25:06 UTC 2025
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.
-------------
Commit messages:
- 8357954: G1: No SATB barriers applied for runtime IN_NATIVE atomics
Changes: https://git.openjdk.org/jdk/pull/25576/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25576&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8357954
Stats: 27 lines in 2 files changed: 27 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/25576.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25576/head:pull/25576
PR: https://git.openjdk.org/jdk/pull/25576
More information about the hotspot-gc-dev
mailing list