[concurrency-interest] DirectByteBuffers and reachabilityFence

David Holmes davidcholmes at aapt.net.au
Wed Dec 9 19:04:10 EST 2015


Justin,

You are right about the intent here. I just found what seems to be a major
error in the JLS in regards to JSR-133.  Here is the text that was supposed
to be included in the JLS update by JSR-133:

"An object cannot be considered finalizable until all of its constructors
have finished. The constructor for class Object must be invoked and complete
normally in order for the object to be finalizable; other
constructors may terminate by throwing exceptions."

http://www.cs.umd.edu/~pugh/java/memoryModel/jsr133.pdf

But that isn't what it says in JLS 12.6.1!

David
-----

> -----Original Message-----
> From: concurrency-interest-bounces at cs.oswego.edu [mailto:concurrency-
> interest-bounces at cs.oswego.edu] On Behalf Of Justin Sampson
> Sent: Thursday, December 10, 2015 9:06 AM
> To: dholmes at ieee.org
> Cc: concurrency-interest at cs.oswego.edu
> Subject: Re: [concurrency-interest] DirectByteBuffers and
> reachabilityFence
> 
> David Holmes wrote:
> 
> > If the finalizer runs concurrently with the constructor then the
> > constructor may well see the actions of the finalize method.
> 
> Nope. For any read r inside the constructor and any write w inside
> the finalizer, we know that hb(r, w), because hb(r, completion of
> constructor) and hb(completion of constructor, execution of finalizer)
> implies hb(r, execution of finalizer). But if r sees the value
> written by w, then the execution is not happens-before consistent and
> therefore it is not a well-formed execution according to the JMM.
> 
> Cheers,
> Justin
> 
> 
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest



More information about the Concurrency-interest mailing list