Re: JavaMemoryModel: Clarification: Acquire/Release Semantics On Volatile Read/Write Is New?

From: Jeremy Manson (jmanson@cs.umd.edu)
Date: Sat Feb 21 2004 - 00:23:46 EST


> This really is a small matter, but I would like an authoritative opinion.
> The introduction to JSR-133 says "The proposed core semantics should not
> cause issues for existing JVM implementation..." This (in a sense) implies
> that the JSR is "upwards compatible" with current VM specifications. Is it
> not the case the release semantics on a volatile write and acquire
> semantics on a volatile read are in fact new requirements? In other words,
> is it not the case that, with respect to volatile accesses, there is a new
> requirement on implementations?

That is the case. And final fields require new treatment.

However, we went to lengths to ensure that it shouldn't be terribly
difficult to incorporate any changes. Volatiles are largely a matter of
inserting the correct barriers at reads and writes. Final fields are
largely a matter of inserting barriers at the end of some constructors.
Generally, standard compiler optimizations are legal.

If people are curious about the details, check out Doug's JSR-133
cookbook. Actually, this is a good read for anyone who hasn't already
read it:

http://gee.cs.oswego.edu/dl/jmm/cookbook.html

                                        Jeremy
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:58 EDT