RFR(s): 8171449" [aarch64] store_klass needs to use store release

Andrew Haley aph at redhat.com
Tue Dec 20 09:21:37 UTC 2016


On 20/12/16 09:14, Thomas Schatzl wrote:
>>>
>> I'm a bit baffled by the reasoning behind all of this.  If a Java
>> thread isn't finished initializing an array then it's not reachable
>> from another thread. 
> 
>   you are probably missing a "Java" between "another" and "thread" here
> to make this statement correct ;)
> 
> The concurrent garbage collectors may scan areas of the heap that is
> currently being allocated into.

Those areas of the heap contain garbage before an object is
initialized.  They can be pointers into the middle of an object,
fields that contain longs which look like object pointers, and so on.
Anything is possible: it's just memory.  Or do the concurrent
collectors scrub the memory being allocated into?

> Setting the object's klass field means to them that the members of the
> particular object have been completely initialized and can be parsed by
> the GC thread(s).

So how does a concurrent GC know that a klass field has been written,
and does not contain leftover garbage?

Andrew.


More information about the hotspot-runtime-dev mailing list