RFR: 8270059: Remove KVHashtable

Ioi Lam iklam at openjdk.java.net
Thu Jul 8 20:08:53 UTC 2021


On Thu, 8 Jul 2021 19:46:32 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> There are now only 2 uses of KVHashtable in the HotSpot code. They can be easily rewritten to use ResourceHashtable and ResizeableResourceHashtable.
>
> src/hotspot/share/cds/archiveBuilder.hpp line 183:
> 
>> 181:   public:
>> 182:     bool do_entry(address key, const SourceObjInfo& value) {
>> 183:       delete value.ref();
> 
> One of the things that I thought that should change with the _src_obj_table is that SourceObjInfo should have a destructor that should call this delete.  But then the table would have to take SourceObjInfo elements and not copy from a stack object.  I think ResourceHashtable's destructor calls delete on all the nodes.  Anyway, that can be a future improvement if you've followed what I mean.

Yes, I plan to add calls to the elements' destructors (perhaps both ~K() and ~V()?) in a separate PR. This would be similar to what `GrowableArray` does when the array elements are removed, or when the array is destroyed.

To do this, we need to get `SourceObjInfo` to work with C++ Move Semantics so that the `_ref` field will not be freed more than once. I am still trying to learn how that works ....

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

PR: https://git.openjdk.java.net/jdk/pull/4715


More information about the hotspot-dev mailing list