JavaMemoryModel: Why I am resisting putting data/control dependences into the semantics

From: Bill Pugh (
Date: Thu Aug 09 2001 - 13:47:00 EDT

A number of other memory models, particularly "Location Consistency"
and CRF, allow operations within a thread to be reordered subject to
data/control dependences. I have resisted this, although avoiding it
has caused a number of other complications in our semantics (e.g.,
prescient writes).

Here is my argument for avoiding any discussion of data/control
dependencies in the semantics.

The notation of what is control or data dependent is very dependent
on the analysis done by the compiler. For example, in

if (A.g >= 0)
   B.x = 1

is the write to B.x control dependent on the read of A.g? At first
glance, the answer is yes. However, what if the compiler is able to
perform a global analysis and prove that all values that could be
written to A.g are non-negative? In that case, the compiler should be
allowed to replace A.g >= 0 with true, and the write to B.x is

So control/data dependences are determined, in part, by what analysis
is able to deduce. But what the analysis can deduce is defined by the
semantics of the language.

So it seems to me that any use of data/control dependences in
defining the semantics creates a circulation definition with no clear
or unique meaning.

I would love to be convinced otherwise. It would simplify our
semantics if we could allow reorderings subject to data/control

JavaMemoryModel mailing list -

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