[aarch64-port-dev ] RFR: [8u] 8209835: Aarch64: elide barriers on all volatile operations

Yangfei (Felix) felix.yang at huawei.com
Wed Aug 28 09:18:51 UTC 2019


>> Volatile access inconsistency still exists for some unsafe operations.  One example is AtomicReference.
>> For the volatile field 'value', compareAndSet() method accesses it through unsafe.compareAndSwapObject().
>> And getAndSet() method accessed it through unsafe.getAndSetObject().
>> Currently, C2 will emit ldar & stlr to implement unsafe.compareAndSwapObject(), but that is not the case for unsafe.getAndSetObject().
>> 
>> C2 still emits explicit dmb instructions to implement unsafe.getAndSetObject().

> I am not convinced. Please provide me with a test case of incorrect behaviour.

Well, I think I won't be able to provide such a test case after some throughts.  Now I agree that this will not affect basic functionality.  
As we have handled unsafe.compareAndSwap, I don't see a reason to not handle unsafe.getAndSet: the risk should be low and we get consistent and improved C2 JIT code.  
What do you think?  

Thanks,
Felix


More information about the aarch64-port-dev mailing list