Bill Pugh wrote:
>
> On Feb 25, 2004, at 3:50 PM, Vijay Saraswat wrote:
>
>>
>> To illustrate my point, lets modify the test case. Here is Test Case 18a
>> ====================================================
>> <H2>Causality test case 18</H2><PRE>Initially, x = y = 0
>>
>> Thread 1:
>> 1: r3 = x
>> 2: if (r3 == 0)
>> 3: x = 42
>> 4: r1 = x
>> 5: y = r1
>>
>> Thread 2:
>> 6: r2 = y
>> 7: x = r2
>>
>> Thread 3:
>> 8: if (false)
>> 9 : x=43
>>
>> Behavior in question: r1 == r2 == r3 == 42
>>
>> Decision: Disallowed.
>> </PRE>
>> <HR>
>> =======================================================
>> If I follow through with your reasoning, the "conservative"
>> calculation (any read can see any write) would say that x can take on
>> the values 0,42,43. (You said lets assume any read can see any write.)
>>
>> Hence Line 4 cannot be replaced with r1=42.
>>
>> So adding "junk" will cause the semantics to disallow a behavior (the
>> proposed behavior for Case 18).
>
>
> You are confusing the compiler with the semantics.
> Adding this additional Thread 3 should not change what behaviors are
> allowed. 18a should still allow r1 = r2 = r3= 42.
>
> However, with this change, the compiler might not actually perform the
> transaction that resulted in that behavior in question. But it is
> still allowed.
Why should 18a be allowed? The reasoning you gave in ur previous message
does not work. Do you have some other reasoning to justify 18a being
allowed?
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:58 EDT