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/library_call.cpp line 5744:

> 5742:             IfNode* iff_hash_would_be_zero = 
> create_and_map_if(control(), bol_hash_would_be_zero, PROB_FAIR, 
> COUNT_UNKNOWN);
> 5743:             avoid_zero_hash_region->init_req(1, 
> IfTrue(iff_hash_would_be_zero));
> 5744:             Node* class_hashcode_masked = AndI(result_empty, 
> hash_mask_con);

The mask was already applied in `LibraryCallKit::get_hashcode_from_header()`.

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

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

Reply via email to