At 4:26 PM -0400 7/6/01, Rob Strom wrote:
>Bill Pugh wrote:
>I thought that according to the version of Bill's volatile proposal
>saw at the time I wrote the ECOOP paper, there was no need for
>force = false in the prod method. Adding that statement is
>a bit disruptive, since it implies that the "read" methods have
>to write to shared memory. The ignore statement in the inc method was
>sufficient to guarantee that any reads of a and b were corralled
>between the writes of vno. And vno being volatile was sufficient to
>corral reads between successive reads of vno. Am I missing something?
>Can you give me an example of a case where (assuming force = false
>is not included in prod) an execution can both commit and return
>the wrong result?
Without the write to force in prod(), the compiler is free to move
the second read of vno up past the reads of a and b, to immediately
after the first read of vno. According to acquire/release semantics,
the compiler is free to reorder normal memory accesses and a
following volatile read.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:32 EDT