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

Quan Anh Mai qamai at openjdk.org
Sun Apr 27 13:23:02 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.

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

Commit messages:
 - remove larval InlineTypeNode

Changes: https://git.openjdk.org/valhalla/pull/1447/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1447&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8335256
  Stats: 732 lines in 17 files changed: 291 ins; 313 del; 128 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