JVM_IR fixes after review

This commit is contained in:
Dmitry Petrov
2021-08-24 13:00:49 +03:00
committed by TeamCityServer
parent f4dd75e769
commit c30b23ed01
6 changed files with 12 additions and 22 deletions
@@ -646,11 +646,6 @@ class ExpressionCodegen(
return MaterialValue(this, type, expression.symbol.owner.realType)
}
private fun IrValueDeclaration.isTemporaryVal() =
this is IrVariable &&
!this.isVar &&
this.origin == IrDeclarationOrigin.IR_TEMPORARY_VARIABLE
internal fun genOrGetLocal(expression: IrExpression, type: Type, parameterType: IrType, data: BlockInfo): StackValue =
if (expression is IrGetValue)
StackValue.local(
@@ -1229,7 +1224,7 @@ class ExpressionCodegen(
val afterStore = markNewLabel()
val catchBody = clause.result
var catchBlockInfo = BlockInfo(data)
val catchBlockInfo = BlockInfo(data)
catchBlockInfo.variables.add(VariableInfo(parameter, index, descriptorType, afterStore))
val catchResult = catchBody.accept(this, catchBlockInfo)
@@ -322,7 +322,10 @@ class JvmOptimizationLowering(val context: JvmBackendContext) : FileLoweringPass
initializer
}
is IrValueParameter ->
return initializer
return if (initializerValue.isAssignable)
null
else
initializer
}
}
@@ -394,9 +397,10 @@ class JvmOptimizationLowering(val context: JvmBackendContext) : FileLoweringPass
}
if (expression.origin == IrStatementOrigin.WHEN) {
// Don't optimize out 'when' subject - otherwise we might get somewhat weird debugging behavior.
// Don't optimize out 'when' subject initialized with a variable,
// otherwise we might get somewhat weird debugging behavior.
val subject = expression.statements.firstOrNull()
if (subject is IrVariable) {
if (subject is IrVariable && subject.initializer is IrGetValue) {
dontTouchTemporaryVals.add(subject)
}
}