RFR: 8269986: Remove +3 from Symbol::identity_hash()

Ioi Lam iklam at openjdk.java.net
Wed Nov 10 20:26:38 UTC 2021


On Tue, 9 Nov 2021 20:01:58 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Please review this trivial change that removes the `+3` from here:
>> 
>> 
>>   unsigned Symbol::identity_hash() const {
>>     unsigned addr_bits = (unsigned)((uintptr_t)this >> (LogMinObjAlignmentInBytes + 3));
>>                                                                                   ^^^
>>     return ((unsigned)extract_hash(_hash_and_refcount) & 0xffff) |
>>            ((addr_bits ^ (length() << 8) ^ (( _body[0] << 8) | _body[1])) << 16);
>>   }
>> 
>> 
>> The `+3` was intended to avoid getting the same value for these bits:
>> 
>> 
>> ((uintptr_t)this) >> LogMinObjAlignmentInBytes) & 0x07)
>> 
>> 
>> However, as shown in the [bug report](https://bugs.openjdk.java.net/browse/JDK-8269986), the values for these bits are evenly distributed. So the `+3` is not necessary and may actually be counter-productive.
>> 
>> Testing: Oracle CI tiers 1-4
>
> Looks good! Thanks for doing the performance analysis.

Thanks @coleenp for the review. @cl4es also reviewed it off-line. Since the change is trivial, I am pushing it now.

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

PR: https://git.openjdk.java.net/jdk/pull/6287


More information about the hotspot-dev mailing list