RFR 8055283: Expand ResourceHashtable with C_HEAP allocation, removal and some unit tests

Mikael Gerdin mikael.gerdin at oracle.com
Mon Aug 18 15:22:46 UTC 2014



On 2014-08-18 16:50, Coleen Phillimore wrote:
>
> The default hash table in hashtable.hpp is a C Heap allocated hash table.

It's not so much a hash table as some bits and pieces which can (and 
have been in some cases) combined to a hash table. You just have to 
write all the methods for it yourself.

Isn't that convenient.

>
> Coleen
>
> On 8/18/14, 10:24 AM, Mikael Gerdin wrote:
>> Hi all!
>>
>> For an upcoming change I need to allocate ResourceHashtables as c-heap
>> objects instead of arena objects. Since the ResourceObj allocation
>> type typically supports c-heap allocation I extended ResourceHashtable
>> with the functionality.
>> I also need a remove method and a size estimate, added those as well.
>>
>> Additionally, I took the liberty to fix the default hash function
>> which appears to be a typo:
>> return hash ^ (hash > 3);
>>  // just in case we're dealing with aligned ptrs
>>
>> I don't think the intention was to xor with "true" if hash was greater
>> than 3, especially given the comment about aligned ptrs.
>>
>> I assume that the original author meant to shift hash to the right
>> since aligned pointers will have a bunch of zeros in the low bits.
>>
>> I also took the liberty to add some simple unit tests to the class to
>> avoid breaking something.
>>
>> Testing: JPRT (including the new unit test) and vm.defmeth.testlist
>> (since default methods seems to be the only user of the default hash
>> function)
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8055283
>>
>> Webrev: http://cr.openjdk.java.net/~mgerdin/8055283/webrev.0
>>
>> /Mikael
>


More information about the hotspot-dev mailing list