JVM support for atomicity guarantees seems more difficult—algorithms for 
ensuring atomicity above 64 bits tend to be prohibitively expensive. The 
current prototype simply gives up on flattening when atomicity is requested; 
not clear whether

Note that this only gives up on flattening *in the heap*; flattening on the 
stack (calling convention optimization) and scalarization are still in play.

Alternatively, can we train programmers to treat out-of-sync values with the 
same tolerance they give to out-of-sync object state in classes that aren't 
thread safe?

Note that to produce tearing, you have to have a data race (i.e., broken 
program), where there is a read-write or write-write race on a reference to a 
primitive class.


Reply via email to