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

Hans Boehm boehm at acm.org
Wed Jul 20 18:20:43 UTC 2016


You are not alone.  I have the suspicion that "word tearing" used to mean
17.7 before the 2005 JLS revision.  But the JLS usage seems to have won,
for better or worse, at least in Java circles.

On Wed, Jul 20, 2016 at 9:59 AM, Martin Buchholz <martinrb at google.com>
wrote:

> 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