RE: JavaMemoryModel: Performing speculative writes ahead of

From: Sylvia Else (
Date: Sun May 30 2004 - 22:34:52 EDT

At 12:20 PM 31/05/2004 +1000, David Holmes wrote:
>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. :)

OK - I note the smilely. Still, that wasn't really where I was coming from.
Essentially the compiler will not reorder the actions of an SC program if
the consequence is observable.

>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.

Neither the language nor the JMM say anything about how long things take.
I'd argue that in that context, there can be no such thing as a "correct"
benchmark that purports to measure the time taken by unobservable actions.
In any case, I don't think you'd get much sympathy for a model that slows
things down in order for it to be possible to see how slow they were ;)


JavaMemoryModel mailing list -

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