[lworld] Integrated: 8335256: [lworld] C2: Remove larval InlineTypeNode

Quan Anh Mai qamai at openjdk.org
Mon May 12 14:36:06 UTC 2025


On Sun, 27 Apr 2025 13:17:10 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.

This pull request has now been integrated.

Changeset: 6a6cf4f7
Author:    Quan Anh Mai <qamai at openjdk.org>
Committer: Tobias Hartmann <thartmann at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/6a6cf4f75583c781b16b44a21eb1254b9d79213f
Stats:     881 lines in 19 files changed: 312 ins; 417 del; 152 mod

8335256: [lworld] C2: Remove larval InlineTypeNode
8325627: [lworld] C2 compilation bailout for TestNullableInlineTypes::test85
8354283: [lworld] TestAllocationMergeAndFolding fails since jdk-25+16, since an allocation is detected

Reviewed-by: thartmann

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

PR: https://git.openjdk.org/valhalla/pull/1447


More information about the valhalla-dev mailing list