RFR: 8292170: Convert CodeRootSetTable to use ResourceHashtable [v4]

Ioi Lam iklam at openjdk.org
Sat Dec 24 05:00:51 UTC 2022


On Fri, 23 Dec 2022 22:50:23 GMT, Leo Korinth <lkorinth 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?
>
> Leo Korinth has updated the pull request incrementally with one additional commit since the last revision:
> 
>   can not use contains in combination with add without a lock

src/hotspot/share/gc/g1/g1CodeCacheRemSet.cpp line 44:

> 42:   return sizeof(*this) +
> 43:     _table.table_size() * sizeof(Table::Node*) +
> 44:     _table.number_of_entries() * sizeof(Table::Node);

Instead of exporting Table::Node and the details of the implementation, maybe ResourceHashtable should have a function that returns its footprint? I don't know what name we usually use for that. Maybe `ResourceHashtable::mem_size()` to follow the example of `G1CodeRootSetTable::mem_size()`?

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

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


More information about the hotspot-dev mailing list