Re: JavaMemoryModel: More Specification

From: Sylvia Else (sylviae@optushome.com.au)
Date: Fri Apr 30 2004 - 02:44:11 EDT


At 05:00 PM 29/04/2004 -0400, Jeremy Manson wrote:

>http://www.cs.umd.edu/~pugh/java/memoryModel/unifiedProposal/model3.pdf

Consider

class Test {
     volatile int x;

     static void main(String args[]) {
         new Test().x = 1;
     }

     public void finalize() {
         int r = x;
     }
}

Behaviour in question: r = 0.

I'm using a _so_ b to mean a is before b in the synchronization order.

For this to occur, we require for some reachability decision point d,

r = x _so_ x = 1 [that is to say, not (x = 1 _ so_ r = x)]
x = 1 comes before d.
r = x comes after d.

Since by hypothesis r =x _so_ x = 1, there is no release acquire pair.
The only accesses of the object other than its initialization and x = 1 are
in the finalizer.
The object is never definitely reachable.

Seems to me that the finalizer model is satisfied by this behaviour.

What have I missed?

Sylvia.

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



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