RE: JavaMemoryModel: Performing speculative writes ahead of

From: David Holmes (dholmes@dltech.com.au)
Date: Sun May 30 2004 - 22:20:51 EDT


Sylvia Else wrote:
> The JMM lets the system do whatever it likes as long as all of
> the actions
> performed in the loop are seen by a thread that sees the write to the
> volatile. In practical terms, it's difficult to imagine an implementation
> that could hoist the volatile write and still comply with the requirement.

I have a problem with semantics that rely on the limits of people's
imagination. :)

> One scenario I can imagine is one where the compiler can prove
> that none of
> the actions in the loop are observed by any other thread anyway. But in
> that case the actions have no observable consequence, so what's the
> objection to the reordering?

How about benchmarks that simulate workload by using a similar code
sequence. It would obviously mess up such benchmarks and there would be
nothing obviously incorrect in the way the benchmark was written.

David Holmes

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



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