On Thu, 1 Sep 2022 06:51:21 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> “Mapping to itself” is how this table works internally. I am not sure if >> this information is useful here. But the purpose of this table is really to >> keep track of all PDs that have been registered and not yet garbage >> collected. > > "mapping to itself" is more useful than "mapping ... to a unique Weakhandle" > - which is even more of an internal implementation detail. I found the use of > this table very hard to discern based on the internal use of the hashtable, > as there is no real mapping operation - we simply track if a PD has been seen > or not. The use of the hashtable is purely for lookup convenience - we could > instead have a linked-list of PD's that we traverse for lookup. > So perhaps we drop my second sentence above, and move it to where the > hashtable itself is declared? "mapping a PD to a unique Weakhandle" is not an implementation detail. It's the only useful API provided by this class: WeakHandle obj = ProtectionDomainCacheTable::add_if_absent(protection_domain); and that's the reason I question why this table is needed at all. ------------- PR: https://git.openjdk.org/jdk/pull/10043