RFR (S): 8191567: Refactor ciInstanceKlass G1 keep alive barrier to use Access API.

David Holmes david.holmes at oracle.com
Tue Nov 28 21:22:37 UTC 2017


Hi Per,

On 28/11/2017 5:53 PM, Per Liden wrote:
> Hi David,
> 
> On 2017-11-28 07:50, David Holmes wrote:
>> Hi Erik,
>>
>> Does "phantom" here have any relationship to PhantomReference?
> 
> Yes, in the sense that this root oop has the same strength as the 
> referent field in a PhantomReference. All non-strong root oops in the VM 
> (StringTable, JNIWeakHandles, etc) are "phantom oops". Internally in the 
> VM they are unfortunately sometimes referred to as "weak roots". With 
> the access API, we're trying to move away from using "weak" for these 
> since "weak" is the strength of the referent in a Soft/Weak/FinalReference.

Ah I see. I hadn't realized we were mis-using "weak" that way.

>>
>> Meta-question on access API: if
>>
>> RootAccess<IN_CONCURRENT_ROOT | ON_PHANTOM_OOP_REF>::oop_load(addr);
>>
>> keeps the value alive, what can cause the value to be allowed to go dead
>> again?
> 
> After a GC, if all existing pointers to this object are phantom oops, 
> then the object is phantom-reachable and those phantom oops will be 
> declared dead and cleared (i.e. same criteria as when a 
> j.l.r.PhantomReference is enqueued).

Sorry this is going OT wrt the actual code review but I'm a bit 
confused. If the above RootAccess marks the oop as PhantomReachable then 
GC can remove it and it wasn't kept alive after all ?? If the above 
makes it stronger than PhantomReachable then GC won't be able to remove 
it, but then how does it return to only being PhantomReachable?

Thanks,
David

> cheers,
> Per
> 
>>
>> Thanks,
>> David
>>
>> On 25/11/2017 2:22 AM, Erik Österlund wrote:
>>> Hi,
>>>
>>> When creating a ciInstanceKlass handle, G1 might need a SATB barrier
>>> to keep "peeked" weak klass pointers alive during marking.
>>> This should now be done with the Access API instead of manual calls to
>>> the G1 SATB barrier.
>>>
>>> Bug:
>>> https://bugs.openjdk.java.net/browse/JDK-8191567
>>>
>>> Webrev:
>>> http://cr.openjdk.java.net/~eosterlund/8191567/webrev.00/
>>>
>>> Thanks,
>>> /Erik


More information about the hotspot-dev mailing list