On Thu, 17 Sep 2026 15:03:21 GMT, Chen Liang <[email protected]> wrote:

>> The identity hash code of value objects currently can produce 0. A zero 
>> value is usually not anticipated for System.identityHashCode calls unless 
>> the argument is null; the 0 hash also cannot be cached. Thus, we should move 
>> away from the 0 hash.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Chen Liang has updated the pull request with a new target base due to a merge 
> or a rebase. The pull request now contains 10 commits:
> 
>  - Fix copyright date
>  - Merge branch 'master' into JDK-8391990
>  - Also, make sure it's set
>  - mask through hash code
>  - Merge branch 'feature/value-hash-zero' of github.com:liachmodded/jdk into 
> feature/value-hash-zero
>  - Compiler part
>  - Merge branch 'master' of github.com:openjdk/jdk into 
> feature/value-hash-zero
>  - Use class identity hash code
>  - Merge branch 'master' of github.com:openjdk/jdk into 
> feature/value-hash-zero
>  - Mask zero value object hash

src/hotspot/share/opto/valuetypenode.cpp line 1132:

> 1130: 
> 1131:   region->add_req(kit->IfTrue(iff_hash_would_be_zero));
> 1132:   Node* class_hashcode_masked = kit->AndI(klass_hash_con, 
> hash_mask_con);

`klass_hash_con` is a valid hash code from the Java mirror's header, so do we 
really need to reapply the mask here?

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

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

Reply via email to