[lworld] RFR: 8377414: [lworld] Improve acmp expansion
Quan Anh Mai
qamai at openjdk.org
Mon Feb 9 21:50:33 UTC 2026
On Sat, 7 Feb 2026 17:09:26 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Hi,
>>
>> This PR improves the acmp expansion:
>>
>> - Do an incremental inlining for easier graph modification.
>> - Take advantage of field values in addition to field types to shortcut the substitutability check.
>>
>> Please take a look and leave your review, thanks a lot.
>
> src/hotspot/share/opto/callnode.cpp line 1387:
>
>> 1385: // Try to replace a runtime call to the substitutability test by either a simple pointer comparison
>> 1386: // if either operand is not a value object, or comparing their fields if either operand is an
>> 1387: // object of a known value type
>
> I think now the contract is substitutability is only called with two non-null value objects of the same class. You can probably be less strict here?
The compiler cannot know the exact runtime types of the operands, it can only know some restrictions on them. For example, with a call `int test(Object o1, Number o2)`, the compiler cannot know the runtime type of `o1` and `o2`, it can only infer that `o2` is a subclass of `Number`, while `o1` can be any object.
As a result, the compiler will emit a call to runtime if it can prove neither: either operand is an identity object, nor either operand is an object of a known value type.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/2066#discussion_r2777811899
More information about the valhalla-dev
mailing list