RFR: 8315131: Clarify VarHandle set/get access on 32-bit platforms [v2]

Chen Liang liach at openjdk.org
Fri Jul 11 19:02:31 UTC 2025


On Fri, 11 Jul 2025 17:45:01 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Correct term is atomic, not word tearing
>
> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 281:
> 
>> 279:  * <li>read write access modes for all {@code T}. On 32-bit platforms, access modes
>> 280:  *     {@code get} and {@code set} for {@code long}, {@code double} and {@code MemorySegment}
>> 281:  *     are supported but not atomic, as described in Section {@jls 17.7}
> 
> Pedantically it is "... but are not guaranteed to be atomic, ...", since IIUC some 32-bit CPU architectures support 64-bit loads and stores (e.g., the ARM A32 LDREXD instruction) so the JVM can do something stronger than what is prescribed by the JMM.

Thanks, updated to be "but may be non-atomic". Please review the CSR as well.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26258#discussion_r2201559182


More information about the core-libs-dev mailing list