Re: JavaMemoryModel: What's "control dependence" mean?

From: Bill Pugh (pugh@cs.umd.edu)
Date: Mon Sep 24 2001 - 12:31:01 EDT


Bug/issue in one of my examples [thanks to Ross Knippel for pointing it out]

At 11:22 AM -0400 9/24/01, Bill Pugh wrote:
>
>Example 2 - forward substitution is illegal
>
>Initially:
>x = 0 and y = 1 and z = 0
>
>Thread 1:
>r1 = z
>x = r1
>r2 = x
>if (r1 == r2)
> y = 2
>
>Thread 2:
>r3 = y
>z = r3
>
>The write y=2 cannot be done early; you can't determine if the write
>y=2 will always occur from purely thread local information. This
>disallows the result r1 = r2 = r3 = 2

No other thread is modifying x, so the write is guaranteed to be
occur (although, of course, you can't determine that with out looking
at non-thread-local information, forbidden by the proposed Java-CRF
clarification). To make it a little more interesting, change thread 2
to:

Thread 2:
r3 = y
z = r3
x = 42
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



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