RFR: 8372845: C2: Fold identity hash code if object is constant [v4]
Chen Liang
liach at openjdk.org
Mon Jan 26 18:33:21 UTC 2026
On Mon, 26 Jan 2026 17:13:08 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/hotspot/share/ci/ciArray.cpp line 93:
>>
>>> 91: // Returns T_ILLEGAL if there is no element at the given index.
>>> 92: ciConstant ciArray::element_value(int index) {
>>> 93: assert(index >= 0, "out-of-bounds index: %d", index);
>>
>> IIUC, this is because you use `-1` as the offset for hashcode, so you need to make sure we are accessing a real element here, or the cache access will return something dubious. I think it is then more uniform to save the value at the cache using the offset instead of the element index.
>
> I think I will not touch ciArray but rather comment on the ConstantValue _off variable about it is just a key.
I decided to rename ConstantValue's off into key, should reduce confusions.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28589#discussion_r2728758977
More information about the hotspot-runtime-dev
mailing list