[jmm-dev] bitwise RMW operators, specifically testAndSetBit/BTS

Paul Sandoz paul.sandoz at oracle.com
Wed Jul 20 14:18:02 UTC 2016


> On 20 Jul 2016, at 12:37, Doug Lea <dl at cs.oswego.edu> wrote:
> 
> On 07/20/2016 04:28 AM, Paul Sandoz wrote:
> 
>> 
>> Perhaps i am asking for trouble bringing this up, but do we require acquire/release variants of getAndAdd and getAndSet? (IMHO we could drop addAndGet).
>> 
> 
> I had noticed this as well. I agree that we ought to do this for the
> sake of consistency; adding:
> 
>  getAndAddRelease, getAndAddAcquire, getAndSetRelease, getAndSetAcquire
> 
> 

Updated:

http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8161444-vhs-bitwise-atomics/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8161444-vhs-bitwise-atomics/webrev/>

Again the same trick with Unsafe methods is applied in the anticipation they will be made intrinsic later on. On second thoughts it may be better if the currently non-intrinsic Unsafe acquire/release variants defer to the stronger volatile variant that is intrinsic. Any opinions on that?


I will defer the removal of addAndGet and the proposed renaming to separate patch.

Paul.


More information about the jmm-dev mailing list