[lworld] RFR: 8274950: [lworld] LoadNode::Identity optimization should not skip casts

Tobias Hartmann thartmann at openjdk.java.net
Tue Oct 19 11:32:25 UTC 2021


When implementing scalarization of nullable inline types with [JDK-8267665](https://bugs.openjdk.java.net/browse/JDK-8267665), I added code to skip cast nodes. This allows the `LoadNode::Identity` optimization to fold loads from `InlineTypePtrNodes` that are hidden behind casts. However, skipping casts is often not correct because not only do we potentially lose type information but the cast could also fail. In the reported case, we hit an assert because we are loading from an offset that does not correspond to a field in the inline type (because the cast would fail).

This patch handles cast nodes properly by pushing them up through the InlineTypePtrNode oop input.

Best regards,
Tobias

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

Commit messages:
 - 8274950: [lworld] LoadNode::Identity optimization should not skip casts

Changes: https://git.openjdk.java.net/valhalla/pull/566/files
 Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=566&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8274950
  Stats: 115 lines in 6 files changed: 93 ins; 1 del; 21 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/566.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/566/head:pull/566

PR: https://git.openjdk.java.net/valhalla/pull/566



More information about the valhalla-dev mailing list