RFR: 8368303: AlwaysAtomicAccesses is excessively strict

Vladimir Ivanov vlivanov at openjdk.org
Wed Sep 24 17:39:35 UTC 2025


On Mon, 22 Sep 2025 16:51:08 GMT, Andrew Haley <aph at openjdk.org> wrote:

> In C1, the experimental flag `AlwaysAtomicAccesses` treats accesses to all fields as if they were volatile fields. This is correct but excessive: we only need single-copy atomicity to satisfy `AlwaysAtomicAccesses`. 
> 
> We need this in order to allow progress on JDK-8365147.

src/hotspot/share/gc/shared/c1/barrierSetC1.cpp line 43:

> 41: // Return true iff an access to bt is single-copy atomic.
> 42: static bool access_is_atomic(BasicType bt) {
> 43: #ifdef CPU_MULTI_COPY_ATOMIC

Why do you require `CPU_MULTI_COPY_ATOMIC`? Why can't you unconditionally treat all sub-word/word accesses (naturally aligned) as atomic instead?  Isn't that what JVM already guarantees?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27432#discussion_r2376543756


More information about the hotspot-dev mailing list