RFR: 8368303: AlwaysAtomicAccesses is excessively strict [v2]
Andrew Haley
aph at openjdk.org
Thu Oct 2 17:14:43 UTC 2025
On Thu, 25 Sep 2025 09:02:21 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> 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?
>
>> 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?
>
> This is about the properties of the hardware rather than the JMM, but yes, every CPU that we support in HotSpot is single-copy atomic. Perhaps I was being excessively cautious, and we can just remove `access_is_atomic()`. I was thinking about some hypothetical processor which didn't have this property.
I tweaked it a bit more.How is it now?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27432#discussion_r2399508392
More information about the hotspot-dev
mailing list