On 6/10/2016 8:55 AM, Mandy Chung wrote:

On Oct 5, 2016, at 2:26 PM, David Holmes <david.hol...@oracle.com> wrote:

On 6/10/2016 6:19 AM, Mandy Chung wrote:


Since domains is not used and not intended to keep PD alive and VM maintains 
its own cache of these initiating PD for performance, removing domains field 
looks good to me.

What then is intended to keep PD alive? Or do we not need to keep them alive?

I have always assumed that domains was used to keep the PD alive for as long as 
the classloader is alive.


Note that PD is the protection domain of an initiating class that resolves a 
target type T.  PD is kept in T’s class loader L.  It’s not the protection 
domains of the classes defined by L.  VM keeps its own cache of protection 
domains that have been validated with a resolved type.  VM does not depend on 
ClassLoader::domains field to keep it alive.  IIUC, it’s kept as a weak 
reference in VM which is what we want here.

Okay but this will still affect the lifecycle of the PDs because without the strong reference in L, those weak references in the VM will quickly be cleared. I'm unclear what the implications of this might be, but I doubt regular short-lived tests would expose any issues.

David
-----

Brent did the archeology and found that the initial fix introduced the domains 
field attempted to use it.  But the initial fix was back out and reimplemented 
and domains is not used.  In any case, this field is not used and depended by 
VM.

Mandy

Reply via email to