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

Martin Buchholz martinrb at google.com
Wed Jul 20 16:59:49 UTC 2016


On Wed, Jul 20, 2016 at 1:25 AM, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:

>
> > 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.)
>
>
YIKES!  I just re-read
17.6. Word Tearing
and
17.7. Non-atomic Treatment of double and long

and now realize I've been using "word tearing" to mean 17.7 instead of 17.6
for many years.  I don't have a good word for 17.6, but I want something
along the lines of "ghost writes" or "collateral damage".

Am I supposed to visualize "tearing" as (sad eye water) tears running out
of one byte across neighbor bytes?


More information about the jmm-dev mailing list