[lworld] RFR: 8228361: [lworld] Optimize the substitutability check in C2

Tobias Hartmann thartmann at openjdk.org
Thu Dec 18 11:46:56 UTC 2025


C2 will now remove the slow call to `ValueObjectMethods::isSubstitutable(Alt)` whenever it's able to determine the layout of one of the operands. It will then emit code to directly compare the fields.

This patch also contains an intrinsic for `_getFieldMap` that will be used by the new core-libs implementation of the substitutability check ([JDK-8370450](https://bugs.openjdk.org/browse/JDK-8370450)) that's used by the interpreter / C1 and as a slow path in C2.

When browsing code, I marked a few rough edges in unrelated code for follow-up cleanups with the corresponding bug numbers.

Testing: tier1-tier6 + valhalla-comp-stress

Thanks,
Tobias

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

Commit messages:
 - More refactoring, better comments
 - More comments, removing workaround
 - Merge
 - v5
 - Refactoring v4
 - Refactoring v3
 - Refactoring, more checks, new test
 - Merge branch 'lworld' into JDK-8228362
 - All tests pass
 - Diagnostic printing
 - ... and 10 more: https://git.openjdk.org/valhalla/compare/9eead93b...4d711c87

Changes: https://git.openjdk.org/valhalla/pull/1823/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1823&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8228361
  Stats: 1503 lines in 30 files changed: 1266 ins; 106 del; 131 mod
  Patch: https://git.openjdk.org/valhalla/pull/1823.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1823/head:pull/1823

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


More information about the valhalla-dev mailing list