On Mon, 21 Sep 2026 08:31:31 GMT, Marc Chevalier <[email protected]> wrote:

>> As far as I can see, there isn't a precedence of mentioning caching or mark 
>> word in this part of the code, so it raises additional questions about the 
>> VM side code that isn't easily visible here. So I think keeping it as simple 
>> as something like the following might be OK:
>> 
>>> // Return an alternate hash code value if the computed hash code is 0 when 
>>> masked with the hashCodeMask()
>> 
>> Now that I read this comment,  I've a related question - is it guaranteed 
>> that if the alternate hash code is returned, then `typeHash & 
>> U.hashCodeMask()` will not be `0`? Sorry if that was already 
>> implied/answered, but I couldn't spot that detail.
>
> Yes, since `typeHash` is the hash of an identity class, so it is guaranteed 
> to be non zero, and to already have the right length, so the masking that 
> happens in the VM won't actually cut anything.

> As far as I can see, there isn't a precedence of mentioning caching or mark 
> word in this part of the code, so it raises additional questions about the VM 
> side code that isn't easily visible here.

It seems to be an artificial distinction to me. This code is tightly coupled 
with the VM one, and has no other use. I don't think it make sense to pretend 
we don't know anything about that because it is not strictly in the same file. 
It is the same topic and I don't think we can pull them apart. I would favor 
being explicit, didactic and bring as much precision as the next one coming can 
use, rather than pretending one can read this code and understand what it does 
while ignoring the VM side of it.

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

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

Reply via email to