RFR(XS): make shared variables volatile
Roman Kennke
rkennke at redhat.com
Thu Sep 22 15:07:30 UTC 2016
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?
Roman
More information about the shenandoah-dev
mailing list