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

John Rose john.r.rose at oracle.com
Wed Jul 20 17:05:48 UTC 2016


On 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?

I call the 17.7 thing "struct tearing", in the State of the Values 2014.
http://cr.openjdk.java.net/~jrose/values/values.html

— John


More information about the jmm-dev mailing list