RFR: 8261158: JVMState should not be shared between SafePointNodes
Tobias Hartmann
thartmann at openjdk.java.net
Tue May 11 07:33: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
-------------
Commit messages:
- 8261158: JVMState should not be shared between SafePointNodes
Changes: https://git.openjdk.java.net/jdk/pull/3951/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3951&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8261158
Stats: 24 lines in 3 files changed: 16 ins; 8 del; 0 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