JVM: remove TypedNullValue, hack interpreter instead
This commit is contained in:
-12
@@ -657,18 +657,6 @@ class ExpressionCodegen(
|
||||
val value = initializer.accept(this, data)
|
||||
initializer.markLineNumber(startOffset = true)
|
||||
value.materializeAt(varType, declaration.type)
|
||||
// We need to generate CHECKCAST from ACONST_NULL here for coroutines,
|
||||
// since otherwise, upon spilling and then unspilling, we will get VerifyError,
|
||||
// because state-machine builder does not know the type of the ACONST_NULL
|
||||
// and assumes it to be Ljava/lang/Object;, which is incorrect.
|
||||
// Generating CHECKCAST hints the state-machine builder the type of the variable
|
||||
// avoiding the issue of VerifyError. See KT-51718
|
||||
// Exception is Ljava/lang/Object;, since CHECKCAST Ljava/lang/Object; is effectively no-op.
|
||||
if (initializer.isNullConst() && varType != OBJECT_TYPE &&
|
||||
(irFunction.isSuspend || irFunction.isInvokeSuspendOfLambda())
|
||||
) {
|
||||
mv.checkcast(varType)
|
||||
}
|
||||
declaration.markLineNumber(startOffset = true)
|
||||
mv.store(index, varType)
|
||||
} else if (declaration.isVisibleInLVT) {
|
||||
|
||||
Reference in New Issue
Block a user