[concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

David Holmes david.holmes at oracle.com
Tue Dec 9 04:51:56 UTC 2014

On 9/12/2014 5:25 AM, Martin Buchholz wrote:
> Webrev updated to remove the comparison with volatile loads and stores.

Thanks. More inline ...

> On Sun, Dec 7, 2014 at 2:40 PM, David Holmes <david.holmes at oracle.com> wrote:
>> On 6/12/2014 7:49 AM, Martin Buchholz wrote:
>>> On Thu, Dec 4, 2014 at 5:55 PM, David Holmes <david.holmes at oracle.com>
>>> wrote:
>>>> In general phrasing like: " also known as a LoadLoad plus LoadStore
>>>> barrier
>>>> ..." is misleading to me as these are not "aliases"- the loadFence (in
>>>> this
>>>> case) is being specified to have the same semantics as the
>>>> loadload|storeload. It should say "corresponds to a LoadLoad plus
>>>> LoadStore
>>>> barrier"
>>> +     * Ensures that loads before the fence will not be reordered with
>>> loads and
>>> +     * stores after the fence; also known as a LoadLoad plus LoadStore
>>> barrier,
>>> I don't understand this.  I believe they _are_ aliases.  The first
>>> clause perfectly describes a "LoadLoad plus LoadStore barrier".
>> I find the language use inappropriate - you are defining the first to be the
>> second.
> Am I missing something?  Is there something else that "LoadLoad plus
> LoadStore barrier" (as used in hotspot sources and elsewhere) could
> possibly mean?

I think we are getting our wires crossed here. My issue is with the wording:

"also known as a LoadLoad plus LoadStore barrier"

because we are explicitly choosing to specify the operation as being a 
LoadLoad plus LoadStore barrier. Hence I would much prefer it to say 
that this "corresponds to a LoadLoad plus LoadStore barrier".

>>>    - as per the "Corresponds to a C11 ...". And referring to things
>>>> like "load-acquire fence" is meaningless without some reference to a
>>>> definition - who defines a load-acquire fence? Is there a universal
>>>> definition? I would be okay with something looser eg:
>>> Well, I'm defining "load-acquire fence" here in the javadoc - I'm
>>> claiming that loadFence is also known via other terminology, including
>>> "load-acquire fence".  Although it's true that "load-acquire fence" is
>>> also used to refer to the corresponding C11 fence, which has subtly
>>> different semantics.
>> When you say "also known as XXX" it means that XXX is already defined
>> elsewhere. Unless there is a generally accepted definition of XXX then this
>> doesn't add much value.
> Everything about this topic is confusing, but I continue to think that
> "load-acquire fence" is a common industry term.

Then please point me to the common industry definition of it because I 
couldn't find anything definitive. And as you state yourself above one 
definition of it - the corresponding C11 fence - does not in fact have 
the same semantics!

> One of the reasons I
> want to include them in the javadoc is precisely because these
> different terms are generally used synonymously.

I would concede "sometimes referred to as ..." as that doesn't imply a 
single standard agreed upon definition, while still making the link. 
Though even then there is a danger of making false assumptions about the 
equivalence of this fence and those going by the name "load-acquire fence".


More information about the core-libs-dev mailing list