diff --git a/compiler/frontend/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt b/compiler/frontend/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt index b2e8a528895..26037f867d4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/config/CommonConfigurationKeys.kt @@ -57,6 +57,15 @@ object CommonConfigurationKeys { @JvmField val PHASES_TO_DUMP_STATE = CompilerConfigurationKey.create>("backend phases where we dump compiler state both before and after the phase") + @JvmField + val PHASES_TO_VALIDATE_BEFORE = CompilerConfigurationKey.create>("backend phases where we validate Ir before the phase") + + @JvmField + val PHASES_TO_VALIDATE_AFTER = CompilerConfigurationKey.create>("backend phases where we validate Ir after the phase") + + @JvmField + val PHASES_TO_VALIDATE = CompilerConfigurationKey.create>("backend phases where we validate Ir both before and after the phase") + @JvmField val VERBOSE_PHASES = CompilerConfigurationKey.create>("verbose backend phases") diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index 1650c2524c1..2e5ece31a0b 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -303,25 +303,6 @@ private val CallsLoweringPhase = makeJsPhase( description = "Handle intrinsics" ) -object IrValidationPhase : CompilerPhase { - - private val validatorConfig = IrValidatorConfig( - abortOnError = true, - ensureAllNodesAreDifferent = true, - checkTypes = false, - checkDescriptors = false - ) - - override val name = "IrValidator" - override val description = "Make sure that various Ir Invariants are met" - override val prerequisite = emptySet() - override fun invoke(context: CommonBackendContext, input: IrModuleFragment): IrModuleFragment { - IrValidator(context, validatorConfig).let { input.acceptVoid(it) } - input.checkDeclarationParents() - return input - } -} - object IrModuleEndPhase : CompilerPhase { override val name = "IrModuleFragment" override val description = "State at end of IrModuleFragment lowering" @@ -345,7 +326,6 @@ val jsPhases = listOf( ModuleCopyingPhase, FunctionInliningPhase, RemoveInlineFunctionsWithReifiedTypeParametersLoweringPhase, - IrValidationPhase, ThrowableSuccessorsLoweringPhase, TailrecLoweringPhase, UnitMaterializationLoweringPhase, @@ -357,7 +337,6 @@ val jsPhases = listOf( LocalDeclarationsLoweringPhase, InnerClassesLoweringPhase, InnerClassConstructorCallsLoweringPhase, - IrValidationPhase, SuspendFunctionsLoweringPhase, CallableReferenceLoweringPhase, DefaultArgumentStubGeneratorPhase, @@ -371,13 +350,11 @@ val jsPhases = listOf( TypeOperatorLoweringPhase, SecondaryCtorLoweringPhase, InlineClassLoweringPhase, - IrValidationPhase, AutoboxingTransformerPhase, BlockDecomposerLoweringPhase, ClassReferenceLoweringPhase, PrimitiveCompanionLoweringPhase, ConstLoweringPhase, - IrValidationPhase, CallsLoweringPhase, IrModuleEndPhase, IrToJsPhase diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt index c7aff732741..27d2100c7de 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/BasicIrBoxTest.kt @@ -136,6 +136,14 @@ abstract class BasicIrBoxTest( .filterNot { it.virtualFilePath.contains(BasicBoxTest.COMMON_FILES_DIR_PATH) } // config.configuration.put(CommonConfigurationKeys.EXCLUDED_ELEMENTS_FROM_DUMPING, setOf("")) + config.configuration.put( + CommonConfigurationKeys.PHASES_TO_VALIDATE_AFTER, + setOf( + "RemoveInlineFunctionsWithReifiedTypeParametersLowering", + "InnerClassConstructorCallsLowering", + "InlineClassLowering", "ConstLowering" + ) + ) val runtimeConfiguration = config.configuration.copy() @@ -165,6 +173,7 @@ abstract class BasicIrBoxTest( // config.configuration.put(CommonConfigurationKeys.PHASES_TO_DUMP_STATE, setOf("UnitMaterializationLowering")) // config.configuration.put(CommonConfigurationKeys.PHASES_TO_DUMP_STATE_BEFORE, setOf("ReturnableBlockLowering")) // config.configuration.put(CommonConfigurationKeys.PHASES_TO_DUMP_STATE_AFTER, setOf("MultipleCatchesLowering")) +// config.configuration.put(CommonConfigurationKeys.PHASES_TO_VALIDATE, setOf("ALL")) val result = compile( config.project,