[lworld] RFR: 8378686: [lworld] C2 fails with assert(_gvn.type(n) == TypePtr::NULL_PTR) failed: must be a null constant

Quan Anh Mai qamai at openjdk.org
Wed Feb 25 15:52:08 UTC 2026


Hi,

    value class MyValue {
        MyValue other;
    }

A cyclic field is not aggressively scalarized, so when we obtain an object of `MyValue`, the field `other` stays as a `LoadP`. When we go `getfield` from a `MyValue`, we obtain the `LoadP` into the state map. We have `InlineTypeNode::adjust_scalarization_depth` but it only has its effect if the field is already an `InlineTypeNode`. We need to add a case to scalarize if the obtained field is an oop.

Many thanks to @TobiHartmann for the test case.

Please kindly review, thanks a lot.

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

Commit messages:
 - Cyclic field should be scalarized at getfield

Changes: https://git.openjdk.org/valhalla/pull/2166/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2166&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8378686
  Stats: 71 lines in 3 files changed: 71 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/valhalla/pull/2166.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2166/head:pull/2166

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


More information about the valhalla-dev mailing list