Native: allow virtual calls in CoroutineLaunchpad intrinsic
This intrinsic was always calling the supplied suspend function non-virtually, and this was hardcoded in the intrinsic generator. Now this can be configured with `superQualifierSymbol` in the respective IrCall, just the way this works with any other calls. As a side effect, global optimizations now process this intrinsic more correctly (before that, they didn't take the intrinsic generator into account, and treated the call as virtual).
This commit is contained in:
committed by
Space
parent
728fe918fe
commit
f8462f1b0c
+1
-1
@@ -192,7 +192,7 @@ internal class IntrinsicGenerator(private val environment: IntrinsicGeneratorEnv
|
||||
environment.evaluateCall(suspendFunction,
|
||||
environment.evaluateExplicitArgs(suspendFunctionCall) + listOf(continuation),
|
||||
environment.calculateLifetime(suspendFunctionCall),
|
||||
suspendFunction.parent as? IrClass, // Call non-virtually.
|
||||
suspendFunctionCall.superQualifierSymbol?.owner,
|
||||
resultSlot,
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -60,10 +60,10 @@ internal class NativeSuspendFunctionsLowering(ctx: Context): AbstractSuspendFunc
|
||||
|
||||
|
||||
override fun IrBuilderWithScope.launchSuspendFunctionWithGivenContinuation(
|
||||
symbol: IrSimpleFunctionSymbol, dispatchReceiver: IrExpression,
|
||||
symbol: IrSimpleFunctionSymbol, superQualifierSymbol: IrClassSymbol?, dispatchReceiver: IrExpression,
|
||||
arguments: List<IrExpression>, continuation: IrExpression
|
||||
) = irCall(this@NativeSuspendFunctionsLowering.context.ir.symbols.coroutineLaunchpad).apply {
|
||||
putValueArgument(0, irCall(symbol).apply {
|
||||
putValueArgument(0, irCall(symbol.owner, superQualifierSymbol = superQualifierSymbol).apply {
|
||||
this.dispatchReceiver = dispatchReceiver
|
||||
arguments.forEachIndexed { index, irExpression ->
|
||||
putValueArgument(index, irExpression)
|
||||
|
||||
Reference in New Issue
Block a user