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

Dean Long dlong at openjdk.org
Wed Jan 28 02:56:57 UTC 2026


On Mon, 26 Jan 2026 19:37:06 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 incrementally with one additional commit since the last revision:
> 
>   Use UpperCamelCase

src/hotspot/share/oops/oop.inline.hpp line 443:

> 441: intptr_t oopDesc::fast_identity_hash_or_no_hash() {
> 442:   // Note: The mark must be read into local variable to avoid concurrent updates.
> 443:   markWord mrk = mark_acquire();

Suggestion:

  markWord mrk = mark();

For the fast case, it seems safe to use mark() like oopDesc::identity_hash() does.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28589#discussion_r2734638145


More information about the hotspot-dev mailing list