RFR(XS): make shared variables volatile
Zhengyu Gu
zgu at redhat.com
Thu Sep 22 15:29:00 UTC 2016
On 09/22/2016 11:07 AM, Roman Kennke wrote:
> Am Donnerstag, den 22.09.2016, 16:04 +0100 schrieb Andrew Haley:
>> On 21/09/16 15:47, Aleksey Shipilev wrote:
>>> On 09/21/2016 04:40 PM, Zhengyu Gu wrote:
>>>> http://cr.openjdk.java.net/~zgu/volatile/webrev.01/
>>> +1
>>>
>>> I wonder if this means we should update/poll these volatile
>>> variables
>>> with Atomic::* too, at least for the benefit of weak arches like
>>> AArch64.
>> Always. volatile is never sufficient for variables accessed racily
>> by
>> multiple threads, and in C++11 it's undefined behaviour. I remember
>> finding and fixing a couple of these when I did the AArch64
>> Shenandoah
>> port.
> The question that came up while discussing this is how to access such
> fields. Atomic and OrderAccess both have no public load() and store()
> methods (or similar). There is load_acquire() and release_store() both
> those are recommended only to be used in pairs. I believe it would have
> the desired effects, but doesn't exactly look clean. Any hints?
Based on recent discussion on runtime-dev mailing list, load_acquire()/release_store()
is the direction openjdk is heading to.
-Zhengyu
>
> Roman
>
More information about the shenandoah-dev
mailing list