RFR: 8372845: C2: Fold identity hash code if object is constant [v4]

Chen Liang liach at openjdk.org
Mon Jan 26 17:40:19 UTC 2026


On Mon, 15 Dec 2025 19:49:52 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Folding identity hash as constant if the incoming argument is constant would be useful for quick map lookups, such as for the [Classifier proposal](https://openjdk.org/jeps/8357674). Currently, identity hash is not constant because it loads the object header/mark word. We can add an explicit bypass to load an existing hash eagerly instead.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
> 
>  - Move test, fix merge garbage
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/identity-hash-const
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/identity-hash-const
>  - Typo
>  - assert
>  - refactorings
>  - Typo
>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/identity-hash-const
>  - Cleanup
>  - identity hash support in C2
>  - ... and 2 more: https://git.openjdk.org/jdk/compare/8652dc25...67a3954f

No, this only covers if a constant enum is passed. If an arbitrary enum constant is passed we still go through sone arithmetics and is slower. But this difference is probably small enough to warrant the removal.

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

PR Comment: https://git.openjdk.org/jdk/pull/28589#issuecomment-3800819255


More information about the hotspot-runtime-dev mailing list