RFR: 8080293: AARCH64: Remove unnecessary dmbs from generated CAS code

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Aug 26 15:41:14 UTC 2015

Looks good. Thank you for clarification.


On 8/26/15 2:35 AM, Andrew Dinn wrote:
> On 25/08/15 18:14, Vladimir Kozlov wrote:
>> Okay, I agree to have only one predicate. So I am fine with version A).
> Thanks, Vladimir. So, that is now as provided in the latest posted webrev:
>    http://cr.openjdk.java.net/~adinn/8080293/webrev.01/
>> PS: "first rule will have a lower" - should compareAndSwapI be first then?
> Sorry, I think the problem here is that I explained the status of the
> original patch in a rather confusing way. I am not sure it matters all
> that much which rule appears first. Or do you really want the lower cost
> rule to appear before the higher cost one? . . .
>>> However, looking again at the code I believe I have the costs (and hence
>>> the predicates) attached to the wrong rules in each pair. For example,
>>> currently the rules include the following details
>>>     compareAndSwapIAcq -- does not emit dmb instructions
>>>       no predicate
>>>       cost  (2 * VOLATILE_REF_COST )
>>>     compareAndSwapI -- emits dmb instructions
>>>       predicate(!needs_acquiring_load_exclusive(n))
>>>       cost VOLATILE_REF_COST
> . . . what I meant by that comment was that this:
>    - The optimization implemented in this patch is based on an assumption
> that a generation strategy using dmb -- i.e. the one encoded by
> compareAndSwapI -- will execute more slowly, or at least no faster, than
> a generation strategy using stlr -- i.e. the one encoded by
> compareAndSwapIAcq.
>    - The text above displays the original costs and predicates used to
> enforce the required rule selection.
>    - In that version the /costs/ are the wrong way round with respect to
> the /motivating assumption/ i.e. compareAndSwapI has a lower cost than
> compareAndSwapIAcq.
> In version A the costs reflect the motivating assumption  i.e. for each
> X in {I, L, P, N} rule compareAndSwapXAcq has a lower cost than
> compareAndSwapX.
> However, it is also true that for each X in {I, L, P, N} rule
> compareAndSwapX appears earlier than compareAndSwapXAcq.
> regards,
> Andrew Dinn
> -----------
> Senior Principal Software Engineer
> Red Hat UK Ltd
> Registered in UK and Wales under Company Registration No. 3798903
> Directors: Michael Cunningham (USA), Matt Parson (USA), Charlie Peters
> (USA), Michael O'Neill (Ireland)

More information about the hotspot-compiler-dev mailing list