[lworld] RFR: 8335256: [lworld] compiler/valhalla/inlinetypes/TestValueConstruction.java fails intermittently [v2]

Quan Anh Mai qamai at openjdk.org
Mon Apr 28 14:30:48 UTC 2025


> 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

 - Merge branch 'lworld' into larvaloop
 - remove larval InlineTypeNode

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/1447/files
  - new: https://git.openjdk.org/valhalla/pull/1447/files/ae3ed360..d9e233ef

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=1447&range=01
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1447&range=00-01

  Stats: 304 lines in 6 files changed: 278 ins; 2 del; 24 mod
  Patch: https://git.openjdk.org/valhalla/pull/1447.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1447/head:pull/1447

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


More information about the valhalla-dev mailing list