6647361: use Unsafe.put*Volatile methods to set final fields during default deserialization

Brian Goetz brian.goetz at oracle.com
Mon Nov 22 14:39:26 UTC 2010

The performance impact of this might be severe when deserializing object 
graphs with lots of final fields (and we recommend using final fields wherever 
possible.)  And, I'm a little unclear on the approach here.  If the goal is to 
provide a happens-before edge between deserializing an object graph and 
reading a final field in that object graph, I don't see how this does it, 
since the reads of those field will be nonvolatile reads.  So this seems like 
it has a big performance cost and doesn't fully solve the problem.

Can you outline the strategy here?

On 11/22/2010 8:52 AM, Alan Bateman wrote:
> This is a patch to default deserialization so that it uses volatile-write when
> setting final fields:
> http://cr.openjdk.java.net/~alanb/6647361/webrev/
> Thanks,
> Alan.

More information about the core-libs-dev mailing list