[lworld] RFR: 8313667: [lworld] XBarrierSetC2::clone_at_expansion() uses wrong array copy stub for cloning flat primitive type arrays

Christian Hagedorn chagedorn at openjdk.org
Tue Sep 5 14:14:34 UTC 2023


The singlegen ZGC version of `XBarrierSetC2::clone_at_expansion()` uses the wrong array copy stub for flat primitive type arrays when expanding an `ArrayCopyNode` for cloning. It wrongly treats a flat array of primitive types as flat array of oop pointers. This leads to intermittent wrong executions and crashes in ZGC because we are interpreting primitive values as oops.

The fix is straight forward to special case flat arrays in `XBarrierSetC2::clone_at_expansion()` similar to what we already do in `ZBarrierSetC2::clone_at_expansion()`:
https://github.com/openjdk/valhalla/blob/3b4cc5fdb038a7363e5ac8a704adacd70701c1ff/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp#L457-L465

Thanks,
Christian

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

Commit messages:
 - clean up test
 - 8313667: [lworld] XBarrierSetC2::clone_at_expansion uses wrong array copy stub for flat clone arrays

Changes: https://git.openjdk.org/valhalla/pull/924/files
 Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=924&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8313667
  Stats: 97 lines in 2 files changed: 96 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/valhalla/pull/924.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/924/head:pull/924

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



More information about the valhalla-dev mailing list