RFR: 8269004 Implement ResizableResourceHashtable [v2]
Ioi Lam
iklam at openjdk.java.net
Tue Jun 29 03:51:05 UTC 2021
On Mon, 28 Jun 2021 21:49:16 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>>
>> @coleenp comments
>
> src/hotspot/share/utilities/resourceHash.hpp line 38:
>
>> 36: MEMFLAGS MEM_TYPE
>> 37: >
>> 38: class ResourceHashtableBase : public ResourceObj {
>
> Rather than a CRTP base class, I think it might be simpler to have a base class that has a type template parameter that provides the sizing/resizing policy. That type might be used either to specify the type of a new member or even a further base class (to benefit from EBO in the size-is-constant case). The derived class constructor would call the base class constructor with a policy object as an argument.
Per Kim's suggestion, I moved the storage management code to two base classes: FixedResourceHashtableStorage and ResizeableResourceHashtableStorage.
Now the `ResourceHashtable::_table[]` is in-line allocated (same as as before this PR). I checked with gcc and it generates identical code as before this PR.
> src/hotspot/share/utilities/resourceHash.hpp line 115:
>
>> 113: }
>> 114:
>> 115: unsigned size() const { return static_cast<const TABLE_IMPL*>(this)->size_impl(); }
>
> I think size() should return the number of entries. The number of buckets should use a different name (assuming it needs to be publically accessible).
In the latest version, I am following the same naming convention in hashtable.hpp:
- table_size() = number of buckets
- number_of_entries() = number of entries
-------------
PR: https://git.openjdk.java.net/jdk/pull/4536
More information about the hotspot-dev
mailing list