[jmm-dev] Make load/store of 64-bit long and double atomic

Doug Lea dl at cs.oswego.edu
Tue Jul 12 12:29:52 UTC 2016

On 07/12/2016 08:21 AM, Aleksey Shipilev wrote:
> On 07/12/2016 02:50 PM, John Crowley wrote:
>>> On Jul 11, 2016, at 10:21 PM, David Holmes
>>> <david.holmes at oracle.com> wrote:
>>> On 7/07/2016 9:29 PM, John Crowley wrote:
>>>> Would like to make a suggestion re the JVM and non-atomic
>>>> load/store for long and double values since both are 64-bit.
>>>> (Sec 17.7 of the JLS version 8 - have not been able to find a JLS
>>>> V9 yet). Did some searching through JSRs and mailing lists, but
>>>> did not see this addressed - please send me a link if it has been
>>>> and I just missed it.
> In Hotspot, there is an experimental -XX:+AlwaysAtomicAccesses flag that
> turns long/double accesses to be single-copy atomic. Not sure it works
> properly in interpreter though. You may build on that.
> The sound counter-argument that I heard against enabling long/double
> atomic accesses is the interaction with value types. If we make all
> present types access-atomic, and have to retract that back when
> larger-than-machine-word value types come in, that would be bad. Since
> this long/double spec change is at best Java 10, we better off seeing
> how it plays out with value types.

Yes, thanks. That's an accurate synopsis of discussions on the jmm-dev
list in 2014. (http://mail.openjdk.java.net/pipermail/jmm-dev/)

In the mean time, we do need to make a clean-up pass on VarHandle
javadocs/specs, that now include some remnants of previous designs
and are missing a few clarifications.


More information about the jmm-dev mailing list