On Wed, 31 Aug 2022 12:39:08 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> Please review this simple conversion for the ProtectionDomainCacheTable from 
>> Old Hashtable to ResourceHashtable.  There are specific tests for this table 
>> in test/hotspot/jtreg/runtime/Dictionary and 
>> serviceability/dcmd/vm/DictionaryStatsTest.java.
>> Also tested with tier1-7.
>
> Coleen Phillimore has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Fix comments, add assert.

I am utterly confused about why we need ProtectionDomainCacheTable at all. The 
only interface between this class and the rest of the world is:


DictionaryEntry::add_protection_domain() {
 
    WeakHandle obj = 
ProtectionDomainCacheTable::add_if_absent(protection_domain);
    // Additions and deletions hold the SystemDictionary_lock, readers are 
lock-free
    ProtectionDomainEntry* new_head = new ProtectionDomainEntry(obj, _pd_set);
}


(and there's code elsewhere for cleaning up this table, but that wouldn't be 
necessary if no one calls `add_if_absent`!).

Why doesn't DictionaryEntry::add_protection_domain allocate the WeakHandle 
itself?

I am looking at the JDK 8 code. It seems like ProtectionDomainCacheTable was 
needed before we had WeakHandle, so we had to do all the reference management 
by hand:

https://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/classfile/dictionary.hpp#l137

But for today, is ProtectionDomainCacheTable a relic that can be thrown away?

-------------

PR: https://git.openjdk.org/jdk/pull/10043

Reply via email to