On Mon, 21 Sep 2026 07:26:15 GMT, Jaikiran Pai <[email protected]> wrote:

>> Chen Liang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Don't overmask
>
> src/java.base/share/classes/jdk/internal/misc/UnsafeConstants.java line 116:
> 
>> 114: 
>> 115:     /**
>> 116:      * The mask used to cut hashes to the hash field in the mark word.
> 
> Is "cut hashes" the right term here? The `Unsafe.hashCodeMask()` on the other 
> hand says:
>> Reports the mask used to fit hashcodes into the cache field of the mark word.
> 
> While at it, this file will need a copyright year update.

I'm guilty of writing this code while not being used to Runtime or Corelib. I 
had trouble coming with some text, and I must say I also don't love it. But I 
happily take suggestions! The idea is that the mask is of the form 0...01...1 
(ones in one segment, in the lower bits, all the ones on the right of the 
zeroes... Phrase it as you will). And so, bitwise-anding with that will select 
only some amount of the lower bits of the hash computed from the field to make 
something that fits in the cache in the mark word, and that's this cut value 
that is the identity hashcode of the value object. But I don't know how to 
phrase that nicely.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32660#discussion_r4060098369

Reply via email to