Release store in C2 putfield
Aleksey Shipilev
aleksey.shipilev at oracle.com
Wed Sep 3 18:10:28 UTC 2014
On 09/03/2014 10:02 PM, Andrew Haley wrote:
> On 09/03/2014 06:47 PM, Aleksey Shipilev wrote:
>> On 09/03/2014 09:00 PM, Andrew Haley wrote:
>>> On 09/03/2014 05:49 PM, Aleksey Shipilev wrote:
>>>> Why is a simple store is sufficient here for AArch64? Do the stores ordered on AArch64 (I thought not)? I thought the "RC" part in "RCsc" only applies to explicit synchronization instructions.
>>>
>>> I discussed this with Peter Sewell, and it's explained in his (co-authored) paper "A Tutorial Introduction to the ARM and POWER Relaxed Memory Models" at http://www.cl.cam.ac.uk/~pes20/ppc-supplemental/test7.pdf in Section 4.1, "Enforcing Order with Dependencies"
>>>
>>> In the AArch64 spec, we have:
>>>
>>> B2.7.2 Ordering requirements
>>>
>>> If an address dependency exists between two reads or between a read and a write, then those memory accesses are observed in program order by all observers within the shareability domain of the memory
>>>
>>> So, an address dependency and a DMB when an object is created is all we need.
>>
>> Okay, I read that paper from Sewell et al. before. I don't quite believe this is about "reading" the constructed objects, and so I don't see how address dependencies are applicable here.
>
> IMO the case he describes is exactly the case we're talking about:
> there is an address dependency between a write which stores the
> address of an object and another thread which reads that stored
> address and uses it to form a field reference.
Nope. Address dependency is between the *read* of the object reference,
and the field read which uses the value from the first read. There is no
address dependency between the write and the read. To quote the paper:
"There is an address dependency from a read instruction to a
program-order-later read or write instruction when the value read by the
first is used to compute the address used for the second."
I understand what you meant, but that's for the *consumer* side. put_xxx
seems to be a *producer* side, and address dependencies are not
applicable here.
>> then it is as well fine for all other architectures (except Alpha)...
>
> I think so, but I'm only sure about AArch64.
So there, let's figure out whether we should just purge the entire block! :)
>> I do think this is an over-cautious secondary release when publishing the reference to the field.
>
> Indeed. Please note that I have done a lot of jcstress testing; not
> that that proves anything with respect to the abstract architecture,
> of course.
Alas, I think the coverage for storing references in subpar in jcstress.
And the proper release store in Parse::do_exits() masks this barrier anyway.
-Aleksey.
More information about the hotspot-dev
mailing list