Make load/store of 64-bit long and double atomic

Aleksey Shipilev aleksey.shipilev at oracle.com
Tue Jul 12 12:21:36 UTC 2016


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.

Thanks,
-Aleksey



More information about the hotspot-dev mailing list