[IR] Simplify logic of interpretCall
Drop excess call of `callStack.loadState(it)` when store state for extension receiver. When we interpret lambda with extension receiver, this receiver will be actually represented as a value parameter, and it required some additional processing. Apparently, after all interpreter's refactorings, this does not matter anymore and excess call can be dropped.
This commit is contained in:
@@ -17,7 +17,10 @@ import org.jetbrains.kotlin.ir.interpreter.proxy.Proxy
|
|||||||
import org.jetbrains.kotlin.ir.interpreter.stack.CallStack
|
import org.jetbrains.kotlin.ir.interpreter.stack.CallStack
|
||||||
import org.jetbrains.kotlin.ir.interpreter.stack.Field
|
import org.jetbrains.kotlin.ir.interpreter.stack.Field
|
||||||
import org.jetbrains.kotlin.ir.interpreter.state.*
|
import org.jetbrains.kotlin.ir.interpreter.state.*
|
||||||
import org.jetbrains.kotlin.ir.interpreter.state.reflection.*
|
import org.jetbrains.kotlin.ir.interpreter.state.reflection.KClassState
|
||||||
|
import org.jetbrains.kotlin.ir.interpreter.state.reflection.KFunctionState
|
||||||
|
import org.jetbrains.kotlin.ir.interpreter.state.reflection.KPropertyState
|
||||||
|
import org.jetbrains.kotlin.ir.interpreter.state.reflection.KTypeState
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
import org.jetbrains.kotlin.ir.util.*
|
import org.jetbrains.kotlin.ir.util.*
|
||||||
@@ -171,8 +174,8 @@ class IrInterpreter(internal val environment: IrInterpreterEnvironment, internal
|
|||||||
if (irFunction.isLocal) callStack.copyUpValuesFromPreviousFrame()
|
if (irFunction.isLocal) callStack.copyUpValuesFromPreviousFrame()
|
||||||
|
|
||||||
// 5. store arguments in memory (remap args on actual names)
|
// 5. store arguments in memory (remap args on actual names)
|
||||||
irFunction.getDispatchReceiver()?.let { callStack.storeState(it, dispatchReceiver!!) }
|
irFunction.getDispatchReceiver()?.let { callStack.storeState(it, dispatchReceiver) }
|
||||||
irFunction.getExtensionReceiver()?.let { callStack.storeState(it, extensionReceiver ?: callStack.loadState(it)) }
|
irFunction.getExtensionReceiver()?.let { callStack.storeState(it, extensionReceiver) }
|
||||||
irFunction.valueParameters.forEachIndexed { i, param -> callStack.storeState(param.symbol, valueArguments[i]) }
|
irFunction.valueParameters.forEachIndexed { i, param -> callStack.storeState(param.symbol, valueArguments[i]) }
|
||||||
// `call.type` is used in check cast and emptyArray
|
// `call.type` is used in check cast and emptyArray
|
||||||
callStack.storeState(irFunction.symbol, KTypeState(call.type, environment.kTypeClass.owner))
|
callStack.storeState(irFunction.symbol, KTypeState(call.type, environment.kTypeClass.owner))
|
||||||
|
|||||||
Reference in New Issue
Block a user