[lworld] RFR: 8376791: [lworld] C2 compilation hits assert(!not_flat || !is_flat()) failed: inconsistency
Tobias Hartmann
thartmann at openjdk.org
Wed Feb 4 13:11:30 UTC 2026
On Wed, 4 Feb 2026 12:41:33 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
> Hi,
>
> The issue is that we blindly assume that the vararg argument is a not flat and not null-free array. This misses 2 factors:
>
> - With the introduction of nullable flat layouts, it is possible to flatten a default array allocation (e.g. `new Integer[4]`)
> - The node may have its own speculative type already, we need to make sure our optimistic guess does not contradict the existing speculation.
>
> As a result, I changed the implementation to assume that the exact type is the default refined type of the declared parameter type.
>
> Testing:
>
> - [ ] tier1-4,valhalla-comp-stress, Linux-x64
>
> Please kindly review, thanks a lot.
Thanks for fixing this. Looks good to me otherwise!
src/hotspot/share/opto/parse1.cpp line 667:
> 665: improved_type = improved_type->join_speculative(t)->is_ptr();
> 666: if (improved_type != t) {
> 667: Node* cast = _gvn.transform(new CheckCastPPNode(control(), parm, improved_type, ConstraintCastNode::DependencyType::NonFloatingNarrowing));
Can't we use default `FloatingNarrowing` here?
-------------
Marked as reviewed by thartmann (Committer).
PR Review: https://git.openjdk.org/valhalla/pull/2030#pullrequestreview-3750976023
PR Review Comment: https://git.openjdk.org/valhalla/pull/2030#discussion_r2763938685
More information about the valhalla-dev
mailing list