missing memory barrier in acmp with C2

Andrew Haley aph at redhat.com
Thu Oct 27 09:17:47 UTC 2016


On 26/10/16 19:31, Vitaly Davidovich wrote:
> On Wed, Oct 26, 2016 at 2:15 PM, Andrew Haley <aph at redhat.com> wrote:
> 
>> On 26/10/16 16:31, Vitaly Davidovich wrote:
>>> On Wednesday, October 26, 2016, Andrew Haley <aph at redhat.com> wrote:
>>
>> The addr of x is in a register already.  We don't need to read it
>> from a field.  It may be an argument, for example.
> 
>>> to figure out dest addr of the store.  As written in your snippet,
>>> the load of x is after the loadload.
>>
>> It's not.
>>
> I interpreted your code as pseudocode, but you seem to be implying some
> other context.  So you're saying you constructed

Let's go back to the original code:

Thread 1:
<Initialize x>
x_init.store_release(true);

Thread 2:
if (x_init.load_aquire())
    x.blah = y

No construction there.

> x in Thread1,
> store_release'd the initialization, passed the address of x to Thread2
> through memory,

No.  Thread2 already has the address of x.  x was constructed a long
time ago.  This initialization is some other code which happens
later.

> See above - your code looks like pseudocode, and x.blah seemed like
> shorthand/pseudocode for loading x and writing a new value to .blah

It's not.

Andrew.


More information about the shenandoah-dev mailing list