On Thu, 1 Sep 2022 07:23:03 GMT, Ioi Lam <ik...@openjdk.org> wrote: >> "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.
The fact it is a weakhandle is an implementation detail. The table simply records whether a PD (wrapped in a WeakHandle) has been seen. ------------- PR: https://git.openjdk.org/jdk/pull/10043