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

Doug Lea dl at cs.oswego.edu
Fri Jul 15 19:17:30 UTC 2016

On 07/15/2016 12:27 PM, Doug Lea wrote:

> ... only the getAndX forms seem useful, with only Volatile
> and Release orderings. Using the default-volatile RMW convention,
> this would require 6 methods:

John suggests the slightly less weird (and thus better):
   getAndBitwiseOr, getAndBitwiseAnd,  getAndBitwiseXor
   getAndBitwiseOrRelease, getAndBitwiseAndRelease, getAndBitwiseXorRelease
that at least separates the two "And"s.

And in the spirit of not making another premature triage proposal,
perhaps these should also include Acquire variants:
  getAndBitwiseOrAcquire, getAndBitwiseAndAcquire, getAndBitwiseXorAcquire

The implicitly-volatile versions should be useful without implementation
penalty in the Acquire use cases that come to mind, but perhaps there are
others. Suggestions welcome.


More information about the jmm-dev mailing list