[IR][K/N] Extracted explicit var spilling phase from coroutines lowering

Not only does it give some flexibility but also it could be turned off
in the future (by providing trivial replacement) as a workaround

 #KT-65153
This commit is contained in:
Igor Chevdar
2024-01-18 16:55:35 +02:00
committed by Space Team
parent 954eade78c
commit 6c05219485
8 changed files with 168 additions and 110 deletions
@@ -25,3 +25,12 @@ internal inline suspend fun getCoroutineContext(): CoroutineContext =
@TypedIntrinsic(IntrinsicType.RETURN_IF_SUSPENDED)
@PublishedApi
internal external suspend fun <T> returnIfSuspended(@Suppress("UNUSED_PARAMETER") argument: Any?): T
@TypedIntrinsic(IntrinsicType.SAVE_COROUTINE_STATE)
@PublishedApi
internal external fun saveCoroutineState()
@TypedIntrinsic(IntrinsicType.RESTORE_COROUTINE_STATE)
@PublishedApi
internal external fun restoreCoroutineState()
@@ -64,6 +64,8 @@ internal class IntrinsicType {
// Coroutines
const val GET_CONTINUATION = "GET_CONTINUATION"
const val RETURN_IF_SUSPENDED = "RETURN_IF_SUSPENDED"
const val SAVE_COROUTINE_STATE = "SAVE_COROUTINE_STATE"
const val RESTORE_COROUTINE_STATE = "RESTORE_COROUTINE_STATE"
// Interop
const val INTEROP_READ_PRIMITIVE = "INTEROP_READ_PRIMITIVE"