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

Vladimir Ivanov vlivanov at openjdk.org
Sat Dec 13 02:35:58 UTC 2025


On Tue, 2 Dec 2025 23:08:44 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.
>
> I tried to come up with an example where the buggy code from Vladimir would inline to identityHashCode when the right call would be virtual - couldn't construct such a case unfortunately :(
> 
> I think we can deal with IGVN later, as this involves creating new macro node and other infrastructure support.

@liach please, incorporate latest version from https://github.com/openjdk/jdk/compare/master...iwanowww:jdk:c2.identity_hash

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

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


More information about the hotspot-dev mailing list