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

Chen Liang liach at openjdk.org
Mon Jan 26 18:33:22 UTC 2026


On Tue, 13 Jan 2026 03:19:14 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/ci/ciObject.hpp line 76:
>> 
>>> 74:   };
>>> 75: 
>>> 76:   const int IDENTITY_HASH_OFFSET = -1;
>> 
>> `const` is fine, but `constexpr` is often preferred. Also, is `static` needed here? Another nitpick is that constants are usually not in uppercase in C++, as macros are often in uppercase.
>
> It is also useful to note what this value is. It is not clear at first glance why offset is -1 here.

I see gc is now using `static constexpr int lowerCamelCase = ...` will use it here too.

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

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


More information about the hotspot-compiler-dev mailing list