On Fri, 11 Jul 2025 14:27:21 GMT, Chen Liang <li...@openjdk.org> wrote:

>> On 32 bit platforms, when an access to long/double is aligned, it is 
>> supported but not atomic. The original wording in 
>> `MethodHandles::byteBufferViewVarHandle` sounds as if it is not supported at 
>> all. We can fix that by borrowing the improved specification from 
>> `MemoryLayout::varHandle`.
>> 
>> Note: This doc is copied from 
>> https://github.com/openjdk/jdk/blob/ee0d309bbd33302d8c6f35155e975db77aaea785/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java#L279-L282
>>  with slight adjustments. See the rendering at 
>> https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/lang/foreign/MemoryLayout.html#access-mode-restrictions
>
> Chen Liang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Correct term is atomic, not word tearing

Marked as reviewed by rgiulietti (Reviewer).

To be super-pedantic, JLS 17.7 does _not_ guarantee atomic access of `long`s 
and `double`s, not even on 64-bit platforms. It only encourages implementations 
to do so if possible.
But I think we can safely assume that quality 64-bit implementations will 
indeed provide atomic access of `long`s and `double`s.

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

PR Review: https://git.openjdk.org/jdk/pull/26258#pullrequestreview-3011123166
PR Comment: https://git.openjdk.org/jdk/pull/26258#issuecomment-3062999765

Reply via email to