[concurrency-interest] Question about "happens-before" andreordering

Pete Soper Pete.Soper at Sun.COM
Fri May 19 12:57:44 EDT 2006

Thomas Hawtin wrote:
> Pete Soper wrote:
>> This seemed quite clear the first time. More fundamentally, if the 
>> constructor never completes, the finalizer's running is impossible, 
>> right?
> JLS 3 states that the finaliser may (because it never must) run if the 
> Object constructor exited normally. 1.6 complies with this (apparently 
> even if instrumentation rewrites the Object constructor).
> I believe earlier editions of the JLS are silent on this. 1.5 (and I 
> presumably earlier versions) will call the finaliser on any object that 
> has been allocated. Possibly not even calling the derived most 
> constructor. IIRC, javac produced byte code does the new, dups the 
> uninitialised reference, evaluates the arguments, then calls the 
> <init>(...)V, so even if the arguments are not fully evaluated the 
> finaliser is called.
> http://www.mernst.org/blog/archives/03-01-2006_03-31-2006.html#46
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4034630

  This is a dupe of 5092933 which I'm happy to say was fixed in build 59 
of Mustang.
   JLS 17.4.5 says the edge is from the end of the constructor, which 
presumably can't be reached if an exception is thrown or the thread 
stops making progress through the constructor. If a more tricky 
definition of "end" is being used, then I shouldn't be surprised, but 
will be anyway.


> Tom Hawtin
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest

More information about the Concurrency-interest mailing list