diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt index df45319f809..cab123428dd 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLoweringPhases.kt @@ -239,18 +239,11 @@ internal val callableReferencePhase = makeKonanFileLoweringPhase( prerequisite = setOf(delegationPhase) // TODO: make weak dependency on `testProcessorPhase` ) -internal val interopPart1Phase = makeKonanFileLoweringPhase( - ::InteropLoweringPart1, - name = "InteropPart1", - description = "Interop lowering, part 1", - prerequisite = setOf(inlinePhase) -) - -internal val interopPart2Phase = makeKonanFileLoweringPhase( - ::InteropLoweringPart2, - name = "InteropPart2", - description = "Interop lowering, part 2", - prerequisite = setOf(localFunctionsPhase) +internal val interopPhase = makeKonanFileLoweringPhase( + ::InteropLowering, + name = "Interop", + description = "Interop lowering", + prerequisite = setOf(inlinePhase, localFunctionsPhase) ) internal val varargPhase = makeKonanFileLoweringPhase( diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt index 0fdac1d120c..c93ad249c81 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt @@ -335,8 +335,7 @@ internal val allLoweringsPhase = namedIrModulePhase( enumClassPhase then delegationPhase then callableReferencePhase then - interopPart1Phase then - interopPart2Phase then + interopPhase then varargPhase then compileTimeEvaluatePhase then coroutinesPhase then diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt index 3510780f9ab..3511cdce7f4 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt @@ -50,7 +50,18 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.module -internal abstract class BaseInteropIrTransformer(private val context: Context) : IrBuildingTransformer(context) { +internal class InteropLowering(context: Context) : FileLoweringPass { + // TODO: merge these lowerings. + private val part1 = InteropLoweringPart1(context) + private val part2 = InteropLoweringPart2(context) + + override fun lower(irFile: IrFile) { + part1.lower(irFile) + part2.lower(irFile) + } +} + +private abstract class BaseInteropIrTransformer(private val context: Context) : IrBuildingTransformer(context) { protected inline fun generateWithStubs(element: IrElement? = null, block: KotlinStubs.() -> T): T = createKotlinStubs(element).block() @@ -105,7 +116,7 @@ internal abstract class BaseInteropIrTransformer(private val context: Context) : protected abstract fun addTopLevel(declaration: IrDeclaration) } -internal class InteropLoweringPart1(val context: Context) : BaseInteropIrTransformer(context), FileLoweringPass { +private class InteropLoweringPart1(val context: Context) : BaseInteropIrTransformer(context), FileLoweringPass { private val symbols get() = context.ir.symbols @@ -799,7 +810,7 @@ internal class InteropLoweringPart1(val context: Context) : BaseInteropIrTransfo /** * Lowers some interop intrinsic calls. */ -internal class InteropLoweringPart2(val context: Context) : FileLoweringPass { +private class InteropLoweringPart2(val context: Context) : FileLoweringPass { override fun lower(irFile: IrFile) { val transformer = InteropTransformer(context, irFile) irFile.transformChildrenVoid(transformer)