RFR(T) 8234628 Change BasicHashTables::new_entry() to use clamp()

Ioi Lam ioi.lam at oracle.com
Tue Jun 2 16:27:41 UTC 2020


Thanks Dan!

- Ioi

On 6/2/20 8:38 AM, Daniel D. Daugherty wrote:
> Thumbs up! I agree that this is a trivial change and doesn't have to
> wait for 24 hours.
>
> Dan
>
>
> On 6/2/20 11:33 AM, Ioi Lam wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8234628
>>
>> A small clean up. Rewrite the code to say what it means to do
>>
>> Tested with mach5 tier1/2
>>
>>
>> $ hg diff
>> diff -r 37c816b004e5 src/hotspot/share/utilities/hashtable.cpp
>> --- a/src/hotspot/share/utilities/hashtable.cpp    Tue Jun 02 
>> 01:08:44 2020 -0700
>> +++ b/src/hotspot/share/utilities/hashtable.cpp    Tue Jun 02 
>> 08:24:59 2020 -0700
>> @@ -61,7 +61,8 @@
>>
>>    if (entry == NULL) {
>>      if (_first_free_entry + _entry_size >= _end_block) {
>> -      int block_size = MIN2(512, MAX3(2, (int)_table_size / 2, 
>> (int)_number_of_entries));
>> +      int block_size = MAX2((int)_table_size / 2, 
>> (int)_number_of_entries); // pick a reasonable value
>> +      block_size = clamp(block_size, 2, 512); // but never go out of 
>> this range
>>        int len = _entry_size * block_size;
>>        len = 1 << log2_int(len); // round down to power of 2
>>        assert(len >= _entry_size, "");
>>
>> Thanks
>> - Ioi
>



More information about the hotspot-runtime-dev mailing list