[lworld] RFR: 8251442: [lworld] C2 compilation fails with assert(value->bottom_type()->higher_equal(_type))

Tobias Hartmann thartmann at openjdk.java.net
Tue Aug 18 14:36:40 UTC 2020


Similar to JDK-8242453 [1], the problem is that a load from a non-flat array can be pushed through an arraycopy from a
flat array (see LoadNode::can_see_arraycopy_value) and end up with an inconsistent memory input (oop load from a flat
array). The checks emitted by the arraycopy intrinsic will catch this and the load will be removed but other Ideal
transformations can still be executed before that happens and encounter this inconsistent state.

The fix is to add CheckCastPPNodes to the arraycopy intrinsic that propagate the information that the src/dst array is
not flat. This makes sure that the data path consistently dies if the input array is in fact a flat array. I've also
removed the workaround from the JDK-8242453 [1] fix.

When updating the type of CheckCastPPNodes, we need to make sure that the not_null_free and not_flat properties of
TypeAryPtr are propagated. This is done by TypeAryPtr::update_properties. A CheckCastPPNode that ends up with an
inconsistent input is then simply replaced by TOP.

This change also includes:
- Optimize subtype checks based on not_null_free/not_flat properties of array types
- New tests to verify that checkcasts are folded if one array type is known to be not null-free/flat and the other type
  is null-free/flat
- Test suite should detect compilation bailouts and fail (currently, only completely missing compilations were detected)
- Renamed "flat_array" to "flatten_array" (which means "flattened in arrays") for consistency with runtime code. We
  should think about a better name.
- Lots of refactoring, removal of default arguments in calls and dead code

[1] https://bugs.openjdk.java.net/browse/JDK-8242453

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

Commit messages:
 - 8251442: [lworld] C2 compilation fails with assert(value->bottom_type()->higher_equal(_type))

Changes: https://git.openjdk.java.net/valhalla/pull/151/files
 Webrev: https://webrevs.openjdk.java.net/valhalla/151/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8251442
  Stats: 450 lines in 17 files changed: 257 ins; 47 del; 146 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/151.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/151/head:pull/151

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


More information about the valhalla-dev mailing list