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

Ioi Lam iklam at openjdk.java.net
Sun Nov 7 21:23:52 UTC 2021


Please review this 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

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

Commit messages:
 - 8269986: Remove +3 from Symbol::identity_hash()

Changes: https://git.openjdk.java.net/jdk/pull/6287/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6287&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8269986
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6287.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6287/head:pull/6287

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


More information about the hotspot-dev mailing list