RFR: 8221836: Avoid recalculating String.hash when zero

Claes Redestad claes.redestad at oracle.com
Mon Apr 8 09:42:54 UTC 2019



On 2019-04-08 11:35, Aleksey Shipilev wrote:
>> Sure, String::hashCode/hash_code locally becomes a bit more complex, but
>> I view this as being a net improvement on the total amount of special
>> handling we need to do for Strings and their hash codes.
> I don't see it. The change *added* new handling for the flag in all those places we used to handle
> zero hash code, and then some.

There's a few simple boilerplate methods added and the logic of 
hash_code(string) is consolidated to mimic String::hashCode, but code at
the real call-sites like stringDedupTable and stringTable is simplified.

/Claes



More information about the hotspot-gc-dev mailing list