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

Paul Sandoz Paul.Sandoz at oracle.com
Wed Jul 20 08:25:29 UTC 2016

> On 20 Jul 2016, at 02:25, Martin Buchholz <martinrb at google.com <mailto:martinrb at google.com>> wrote:
> On Tue, Jul 19, 2016 at 1:51 PM, Andrew Haley <aph at redhat.com <mailto:aph at redhat.com>> wrote:
> On 19/07/16 09:39, Paul Sandoz wrote:
> > Plain behaves like non-volatile/non-final field access e.g. like
> > get/putfield byte codes.
> We should probably clarify whether we really mean that even word-tearing on longs/doubles is allowed.

Just to be clear you are referring to atomicity rather than word tearing as specified by JLS:

https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.6 <https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.6>

? (I have tended to use word tearing interchangeably in the past and it has caused confusion.)

> C++ relaxed atomics are (perhaps!) stronger than "plain" in two senses: truly atomic (!) and single-memory-location-sequentially-consistent.

Yes, it’s the latter that seems harder to apply.


More information about the jmm-dev mailing list