On Mon, 21 Sep 2026 07:38:35 GMT, Marc Chevalier <[email protected]> wrote:
>> 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. I will give it a bit more thought, but I can't think of anything concise and better right now. But it's not necessary to wait on this internal code comment change. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32660#discussion_r4060754147
