[lworld] RFR: 8309650: [lworld] Fix mismatch inline type issue during method calls
Xiaohong Gong
xgong at openjdk.org
Fri Jun 9 08:37:25 UTC 2023
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`
-------------
Commit messages:
- 8309650: [lworld] Fix mismatch inline type issue during method calls
Changes: https://git.openjdk.org/valhalla/pull/860/files
Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=860&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8309650
Stats: 96 lines in 3 files changed: 93 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/valhalla/pull/860.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/860/head:pull/860
PR: https://git.openjdk.org/valhalla/pull/860
More information about the valhalla-dev
mailing list