RFR: 8292170: Convert CodeRootSetTable to use ResourceHashtable

Leo Korinth lkorinth at openjdk.org
Thu Dec 15 12:05:08 UTC 2022


On Wed, 14 Dec 2022 14:48:42 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> I am replacing the old hash table with ResourceHashtable. In the process I am also removing the redundant `_length` field. By removing the `_length` field, a lot of asserts can be removed as the length will trivially match the length of the underlying table.
>> 
>> I would like to have feedback on the addition of `unlink_destruct(Function&& should_remove)`. I added it because I prefer to use a functor object that can be used by lambdas instead of an iterator object. However, I did add code to "destruct" resource objects when they are removed instead of just letting them be to reflect that we use `delete` on c-heap objects. Maybe I should remove this "improvement" and then maybe implement the function by calling the existing unlink?
>
> src/hotspot/share/utilities/resourceHash.hpp line 277:
> 
>> 275:   }
>> 276: 
>> 277:   // The argument should_remove() have the signature: bool Function(K const&, V const&).
> 
> Can you make the unlink a separate change?  I think unlink with the Function argument should be an overload of unlink() and implemented like the iterate function. I don't immediately understand the additional &&s.
> If it's a separate change, we can fix the other callers to use lambdas, which would be nicer.
> Also, I think calling the ResourceObj destructor is another discussion - they are not typically used and I think the discussion should be somewhere else.

I will rework it.

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

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


More information about the hotspot-dev mailing list