[aarch64-port-dev ] RFR: 8144993: Elide redundant memory barrier after AllocationNode

Andrew Haley aph at redhat.com
Tue Dec 15 10:42:17 UTC 2015


On 15/12/15 10:27, Doerr, Martin wrote:

> I think this change is good with respect to concurrent java threads.
> However, I'm not sure if concurrent GC may have a problem when we
> optimize out the memory barrier (with or without this change).
> 
> Is it guaranteed that no concurrent GC will ever read an object
> header of such a newly allocated object?
> A reference to this object may get written somewhere where GC can
> find it. If the GC reads the header, it may read stale data.

We know that the reference to the newly-created object does not
escape, so it is not reachable from any reference.  The only other way
a GC might find it is at a safepoint.  But even if that happens, a
safepoint is a memory barrier.  So I think we're OK.

Andrew.


More information about the aarch64-port-dev mailing list