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

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


On Sun, 7 Nov 2021 21:10:35 GMT, Ioi Lam <iklam 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

This pull request has now been integrated.

Changeset: df02daa6
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/df02daa6f9df801a7e0b6203fd6411d8a62bb277
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod

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

Reviewed-by: coleenp

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

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


More information about the hotspot-dev mailing list