[lworld] RFR: 8309650: [lworld] Fix mismatch inline type issue during method calls
Tobias Hartmann
thartmann at openjdk.org
Tue Jun 13 14:06:15 UTC 2023
On Fri, 9 Jun 2023 08:31:29 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:
> JVM crashes with following assertion failure when running the new added
> test case (i.e. `compiler/valhalla/inlinetypes/TestCastMismatch.java`):
>
>
> A fatal error has been detected by the Java Runtime Environment:
>
> Internal Error (/mnt/local/code/valhalla/src/hotspot/share/opto/graphKit.cpp:3414), pid=1533674, tid=1533690
> assert(stopped() || !toop->is_inlinetypeptr() || obj->is_InlineType()) failed: should have been scalarized
>
> Problematic frame:
> V [[libjvm.so](http://libjvm.so/)+0xd2c070] GraphKit::gen_checkcast(Node*, Node*, Node**, bool)+0x46c
>
>
> The failure happens when compiler knows the type of the `checkcast`
> input is a value/primitive class, while the input node is not an
> `InlineTypeNode`. Note that `InlineTypeNode` is use to represent each
> value/primitive class instance.
>
> In the test case, the input of cast is a method call. And from the
> method declaration, the return type of this method is an abstract class
> whose concrete subclass is a value class. From the method signature,
> the compiler knows the return type is not a value class. Hence, when
> it handles the return result of this method call, no `InlineTypeNode`
> is generated. But when compiler handles the `checkcast` bytecode, it
> checks the speculative type of the input, which is actually the concrete
> class of the instance. In this case, it is the value class. So compiler
> expects the input node is an `InlineTypeNode`.
>
> To fix this issue, the compiler has to use the consistent type system
> for different routines. This patch changes to use the speculative
> type of the method call as well when handling the call's return result.
> With this change, an `InlineTypeNode` is generated for this case after
> the call, and the assertion pass.
>
> Verified with `hotspot::hotspot_all, jdk::tier1,tier2,tier3, langtool::tier1`
Looks good to me, thanks for fixing! Let me run this through our testing and report back once it passed.
-------------
Marked as reviewed by thartmann (Committer).
PR Review: https://git.openjdk.org/valhalla/pull/860#pullrequestreview-1477263835
More information about the valhalla-dev
mailing list