diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt index bb3a39d6ba5..35c038f1999 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt @@ -114,7 +114,7 @@ private fun unfoldValueParameters(expression: IrFunctionAccessExpression, enviro val hasDefaults = (0 until expression.valueArgumentsCount).any { expression.getValueArgument(it) == null } if (hasDefaults) { val ownerWithDefaults = expression.getFunctionThatContainsDefaults() - environment.cachedFunctionsWithDefaults[ownerWithDefaults.symbol]?.let { + environment.createdFunctionsCache[ownerWithDefaults.symbol]?.let { val callToDefault = it.owner.createCall().apply { expression.copyArgsInto(this) } callStack.addInstruction(CompoundInstruction(callToDefault)) return @@ -159,7 +159,7 @@ private fun unfoldValueParameters(expression: IrFunctionAccessExpression, enviro (0 until expression.valueArgumentsCount).forEach { callWithAllArgs.putValueArgument(it, actualParameters[it]?.createGetValue()) } defaultFun.body = (actualParameters.filterIsInstance() + defaultFun.createReturn(callWithAllArgs)).wrapWithBlockBody() - environment.cachedFunctionsWithDefaults[ownerWithDefaults.symbol] = defaultFun.symbol + environment.createdFunctionsCache[ownerWithDefaults.symbol] = defaultFun.symbol val callToDefault = defaultFun.createCall().apply { expression.copyArgsInto(this) } callStack.addInstruction(CompoundInstruction(callToDefault)) } else { diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreterEnvironment.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreterEnvironment.kt index da6a56fe6c5..d3c2bb97a42 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreterEnvironment.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreterEnvironment.kt @@ -23,8 +23,7 @@ class IrInterpreterEnvironment( internal val irExceptions = mutableListOf() internal var mapOfEnums = mutableMapOf() internal var mapOfObjects = mutableMapOf() - internal var cachedFunctionsWithDefaults = mutableMapOf() - internal var cachedLambdasAndReferences = mutableMapOf() + internal var createdFunctionsCache = mutableMapOf() init { mapOfObjects[irBuiltIns.unitClass] = Common(irBuiltIns.unitClass.owner) diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/reflection/KFunctionState.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/reflection/KFunctionState.kt index 04eb5b77bfa..47d995fced6 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/reflection/KFunctionState.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/state/reflection/KFunctionState.kt @@ -39,7 +39,7 @@ internal class KFunctionState( private var _returnType: KType? = null private var _typeParameters: List? = null - val invokeSymbol: IrFunctionSymbol = environment.cachedLambdasAndReferences + val invokeSymbol: IrFunctionSymbol = environment.createdFunctionsCache .getOrDefault( irFunction.symbol, createInvokeFunction(