RFR: 8261158: JVMState should not be shared between SafePointNodes [v2]

Tobias Hartmann thartmann at openjdk.java.net
Tue May 11 13:21:33 UTC 2021


> We often, for example with loop strip mining, clone `SafePointNodes` without cloning their `JVMState`, leading to the same state being shared by different nodes. With Valhalla, we then hit asserts when aggressively scalarizing inline types in safepoints during IGVN because `debug_end()` (`_endoff`) of the attached `JVMState` is larger than `SafePointNode::_max`. That happens because the same `JVMState` has been modified during scalarizing in another `SafePointNode`, the details are described in https://github.com/openjdk/valhalla/pull/322. I don't think `JVMStates` should be shared between safepoint nodes and added an assert to catch this.
> 
> The fix is to always shallow clone the `JVMState` when cloning a `SafepointNode`. Sometimes, a deep clone is required already by current code for `CallNodes` (see `CallNode::needs_clone_jvms`), I left that code as is.
> 
> Thanks,
> Tobias

Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:

  Rename needs_clone_jvms -> needs_deep_clone_jvms

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3951/files
  - new: https://git.openjdk.java.net/jdk/pull/3951/files/03878127..74a29a0f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3951&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3951&range=00-01

  Stats: 25 lines in 6 files changed: 0 ins; 0 del; 25 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3951.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3951/head:pull/3951

PR: https://git.openjdk.java.net/jdk/pull/3951


More information about the hotspot-compiler-dev mailing list