RFR: 8372634: C2: Materialize type information from instanceof checks [v2]
Vladimir Ivanov
vlivanov at openjdk.org
Mon Dec 1 19:51:48 UTC 2025
On Thu, 27 Nov 2025 14:08:03 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Test fix
>
> src/hotspot/share/opto/parse2.cpp line 1739:
>
>> 1737: }
>> 1738:
>> 1739: // Match an instanceof check.
>
> We seem to require that the input of `SubTypeCheck` is not `null`. What do you think about allowing `SubTypeCheck` to accept `null` and return `false`?
Yes, it's a good idea and the right direction to move. While experimenting with a different enhancement, I noticed that a subtype check leaves a null check behind irrespective of whether the check goes away or not.
Unfortunately, there are some engineering considerations which complicates the change. `SubTypeCheck` is shared across all the places where subtype checks are performed, but `checkcast` and `instanceof` differ in the way `null` is handled. So, the proper way to fix it is to introduce a higher-level representation which implicitly handles nulls and then eventually lower it to `SubTypeCheck` and materialize null check if needed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28517#discussion_r2578397399
More information about the hotspot-compiler-dev
mailing list