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

From: Doug Lea (dl@cs.oswego.edu)
Date: Fri Aug 10 2001 - 08:16:19 EDT


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

I'm not at the moment convinced that it would be so hard
to define dependencies adequately for our purposes.

Can't we define control dependence along the lines of "if there is any
possible execution of the program in which a statement is not
executed, then it is dependent on the values of variables controlling
whether it is executed". This needs some work to get exactly right,
but offhand, it doesn't seem like that much work.

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



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