[JVM_IR] Move variables out of IrInlinedFunctionBlock on MFVC lowering
Variables in `IrInlinedFunctionBlock` declared before the composite blocks with arguments evaluation may lead to error on codegen while processing `IrInlinedFunctionBlock`. ^KT-58779: Fixed
This commit is contained in:
committed by
Space Team
parent
4f1d181c88
commit
b8b8b7fd3a
+7
@@ -1423,6 +1423,13 @@ private fun findNearestBlocksForVariables(variables: Set<IrVariable>, body: Bloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitBlock(expression: IrBlock) {
|
override fun visitBlock(expression: IrBlock) {
|
||||||
|
// This is a workaround.
|
||||||
|
// We process IrInlinedFunctionBlock on codegen in a special way by processing composite blocks with arguments evaluation first.
|
||||||
|
// Thus, we don't want IrInlinedFunctionBlock to contain variable declarations before this composite blocks.
|
||||||
|
// That is why we move variable declarations from IrInlinedFunctionBlock to the outer block.
|
||||||
|
if (expression is IrInlinedFunctionBlock) {
|
||||||
|
return super.visitBlock(expression)
|
||||||
|
}
|
||||||
currentStackElement()?.let { childrenBlocks.getOrPut(it) { mutableListOf() }.add(Block(expression)) }
|
currentStackElement()?.let { childrenBlocks.getOrPut(it) { mutableListOf() }.add(Block(expression)) }
|
||||||
stack.add(Block(expression))
|
stack.add(Block(expression))
|
||||||
super.visitBlock(expression)
|
super.visitBlock(expression)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
// WITH_COROUTINES
|
// WITH_COROUTINES
|
||||||
// TARGET_BACKEND: JVM_IR
|
// TARGET_BACKEND: JVM_IR
|
||||||
// IGNORE_INLINER: IR
|
|
||||||
// LANGUAGE: +ValueClasses
|
// LANGUAGE: +ValueClasses
|
||||||
// FIR_IDENTICAL
|
// FIR_IDENTICAL
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user