From 1dc8494824bbada6472152c68ce62b8158819852 Mon Sep 17 00:00:00 2001 From: Igor Chevdar Date: Mon, 28 Jan 2019 12:04:32 +0300 Subject: [PATCH] Reordered compiler phases Moved finally blocks, data classes and for loops lowerings down along the pipeline --- .../kotlin/backend/konan/KonanLower.kt | 22 +++++++++---------- .../kotlin/backend/konan/KonanPhases.kt | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt index 7d097a458c1..778136ebed4 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanLower.kt @@ -74,12 +74,6 @@ internal class KonanLower(val context: Context, val parentPhaser: PhaseManager) phaser.phase(KonanPhase.LOWER_STRING_CONCAT) { StringConcatenationLowering(context).lower(irFile) } - phaser.phase(KonanPhase.LOWER_DATA_CLASSES) { - DataClassOperatorsLowering(context).runOnFilePostfix(irFile) - } - phaser.phase(KonanPhase.LOWER_FOR_LOOPS) { - ForLoopsLowering(context).lower(irFile) - } phaser.phase(KonanPhase.LOWER_ENUM_CONSTRUCTORS) { EnumConstructorsLowering(context).run(irFile) } @@ -96,18 +90,24 @@ internal class KonanLower(val context: Context, val parentPhaser: PhaseManager) phaser.phase(KonanPhase.LOWER_TAILREC) { TailrecLowering(context).runOnFilePostfix(irFile) } - phaser.phase(KonanPhase.LOWER_FINALLY) { - FinallyBlocksLowering(context).lower(irFile) - } phaser.phase(KonanPhase.LOWER_DEFAULT_PARAMETER_EXTENT) { DefaultArgumentStubGenerator(context, skipInlineMethods = false).runOnFilePostfix(irFile) KonanDefaultParameterInjector(context).lower(irFile) } + phaser.phase(KonanPhase.LOWER_INNER_CLASSES) { + InnerClassLowering(context).runOnFilePostfix(irFile) + } + phaser.phase(KonanPhase.LOWER_FOR_LOOPS) { + ForLoopsLowering(context).lower(irFile) + } + phaser.phase(KonanPhase.LOWER_DATA_CLASSES) { + DataClassOperatorsLowering(context).runOnFilePostfix(irFile) + } phaser.phase(KonanPhase.LOWER_BUILTIN_OPERATORS) { BuiltinOperatorLowering(context).lower(irFile) } - phaser.phase(KonanPhase.LOWER_INNER_CLASSES) { - InnerClassLowering(context).runOnFilePostfix(irFile) + phaser.phase(KonanPhase.LOWER_FINALLY) { + FinallyBlocksLowering(context).lower(irFile) } phaser.phase(KonanPhase.TEST_PROCESSOR) { TestProcessor(context).process(irFile) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt index 0897e1e6321..dd2ac827d0b 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanPhases.kt @@ -45,7 +45,7 @@ enum class KonanPhase(val description: String, /* ... ... */ LOWER_COMPILE_TIME_EVAL("Compile time evaluation lowering", LOWER_VARARG, enabled = false), /* ... ... */ LOWER_INNER_CLASSES("Inner classes lowering", LOWER_DEFAULT_PARAMETER_EXTENT, GEN_SYNTHETIC_FIELDS), /* ... ... */ LOWER_BUILTIN_OPERATORS("BuiltIn Operators Lowering", LOWER_DEFAULT_PARAMETER_EXTENT), - /* ... ... */ LOWER_COROUTINES("Coroutines lowering", LOWER_LOCAL_FUNCTIONS), + /* ... ... */ LOWER_COROUTINES("Coroutines lowering", LOWER_LOCAL_FUNCTIONS, LOWER_FINALLY), /* ... ... */ LOWER_TYPE_OPERATORS("Type operators lowering", LOWER_COROUTINES), /* ... ... */ BRIDGES_BUILDING("Bridges building", LOWER_COROUTINES), /* ... ... */ LOWER_STRING_CONCAT("String concatenation lowering"),