Release store in C2 putfield

Andrew Haley aph at
Thu Sep 4 13:13:37 UTC 2014

On 09/04/2014 11:36 AM, David Holmes wrote:
> On 4/09/2014 8:22 PM, Andrew Haley wrote:
>> On 09/04/2014 11:15 AM, David Holmes wrote:
>>> I'll also add that a "barrier" at the end of construction is not
>>> necessarily sufficient as Bertrand has already mentioned, if 'this' can
>>> escape.
>> Can you provide us with an example of this which isn't a Java
>> programmer error?
> To clarify there are two sets of object state we are concerned with:
> - internal VM state that ensures the platform safety guarantees are met 
> (ie all fields default initialized, valid vtable and object header seen)
> - Java level state
> The first requires a suitable "barrier" before Java constructor code is 
> executed so that Java programmer errors do not lead to crashes. So a 
> barrier at the end of construction is not sufficient.

Yes, I've got both of those.

> If you have the barrier at the start of construction then you don't need 
> a barrier at the end except potentially as part of the freeze semantic 
> for final fields. (Though updated JMM in Java 9 may indeed require such 
> a barrier.)



More information about the hotspot-dev mailing list