Support Ir Validation in phaser
This commit is contained in:
@@ -57,6 +57,15 @@ object CommonConfigurationKeys {
|
||||
@JvmField
|
||||
val PHASES_TO_DUMP_STATE = CompilerConfigurationKey.create<Set<String>>("backend phases where we dump compiler state both before and after the phase")
|
||||
|
||||
@JvmField
|
||||
val PHASES_TO_VALIDATE_BEFORE = CompilerConfigurationKey.create<Set<String>>("backend phases where we validate Ir before the phase")
|
||||
|
||||
@JvmField
|
||||
val PHASES_TO_VALIDATE_AFTER = CompilerConfigurationKey.create<Set<String>>("backend phases where we validate Ir after the phase")
|
||||
|
||||
@JvmField
|
||||
val PHASES_TO_VALIDATE = CompilerConfigurationKey.create<Set<String>>("backend phases where we validate Ir both before and after the phase")
|
||||
|
||||
@JvmField
|
||||
val VERBOSE_PHASES = CompilerConfigurationKey.create<Set<String>>("verbose backend phases")
|
||||
|
||||
|
||||
@@ -303,25 +303,6 @@ private val CallsLoweringPhase = makeJsPhase(
|
||||
description = "Handle intrinsics"
|
||||
)
|
||||
|
||||
object IrValidationPhase : CompilerPhase<CommonBackendContext, IrModuleFragment> {
|
||||
|
||||
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<BackendContext, IrModuleFragment> {
|
||||
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
|
||||
|
||||
@@ -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("<JS_IR_RUNTIME>"))
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user