[lworld] RFR: 8335256: [lworld] C2: Remove larval InlineTypeNode [v6]
Quan Anh Mai
qamai at openjdk.org
Mon May 12 13:40:13 UTC 2025
On Fri, 9 May 2025 17:55:46 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Hi
>>
>> The root issue is that a larval value object is fundamentally different from a non-larval one. The most important thing is that it has a unique identity and it expects any modification on 1 reference observable by all other equivalent references. As a result, we need a mechanism to track the identity of a larval object, which `InlineTypeNode` does not provide. My current proposal to fix this issue is to abandon larval `InlineTypeNode`s and use the oop like other objects.
>>
>> It is probably beneficial to have another mechanism to make it easier optimizing larval inline type nodes, but I think it can be a follow-up RFE.
>>
>> An example regarding the issue with tracking the identity of a larval InlineTypeNode:
>>
>> Consider this pseudobytecode sequence:
>>
>> new MyValue;
>> dup;
>> loop;
>> invokespecial MyValue::<init>;
>> areturn;
>>
>> There are 2 equivalent references in the stack at the loop entry. When `Parse::merge` encounters them, it cannot know that these are the same because the back-edge has not been processed yet. As a result, it creates 2 separate `Phi`s for these references. Then, `invokespecial` will only make the top of the stack a non-larval object, not the next one, which is the one returned to the caller. As a result, we fail with `assert(!value->is_InlineType() || !value->as_InlineType()->is_larval(), "returning a larval")`. Worse, if the method is osr-compiled at the loop head, we have 2 separate references fed into the compiled function and there is no way we may know that they are of the same object.
>>
>> Please take a look and leave your reviews, thanks a lot.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>
> Tobias' comments
Thanks very much for the reviews, I have created [JDK-8356779](https://bugs.openjdk.org/browse/JDK-8356779) and [JDK-8356780](https://bugs.openjdk.org/browse/JDK-8356780).
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/1447#issuecomment-2872614653
More information about the valhalla-dev
mailing list