[lworld] RFR: 8239003: [lworld] C2 should respect larval state when scalarizing

Jatin Bhateja jbhateja at openjdk.org
Wed Dec 20 13:39:13 UTC 2023


Hi All,

Patch addresses the issue seen around unsafe updates to value objects within a loop.

Since Unsafe.put* APIs returns a void, hence it does not alter JVM state. Due to this ciTypeFlow dataflow analysis does
not encounter an inductive definition corresponding to updated value object within the loop, due to this C2 parser misses
creating an inductive phi node on encountering loop header block.

In order to maintain IR compliance with ciTypeFlow analysis C2 should prevent scalarizing value object b/w make and finish
private buffer calls.

New behavior of unsafe inline expanders

* makePrivate: Receive InlineTypeNode input and return initialized buffer in larval state.
* finishPrivateBuffer: Receive value object buffer input and return rematerialize InlineTypeNode in non-larval state.
  This may result into creation of unbalanced phi node at control flow merges where one of the phi input may InlineTypeNode
  and other is a buffer of compatible value type, but the IR still remains valid.

In addition compiler is now preventing elimination of allocation in larval state.

Validation Status:-

All the Valhalla JTREG tests are passing at various AVX level with / wo -XX:+DoptimizeALot.

Kindly review and share your feedback.

Best Regards,
Jatin

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

Commit messages:
 - 8239003: [lworld] C2 should respect larval state when scalarizing

Changes: https://git.openjdk.org/valhalla/pull/964/files
 Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=964&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8239003
  Stats: 176 lines in 8 files changed: 112 ins; 32 del; 32 mod
  Patch: https://git.openjdk.org/valhalla/pull/964.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/964/head:pull/964

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



More information about the valhalla-dev mailing list