Use PhaseConfigurationService in CompilerPhase instead of PhaseConfig
This commit is contained in:
committed by
Space Team
parent
06182fe547
commit
54deba63a1
+8
-8
@@ -28,7 +28,7 @@ inline fun <R, D> PhaserState<D>.downlevel(nlevels: Int, block: () -> R): R {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface CompilerPhase<in Context : CommonBackendContext, Input, Output> {
|
interface CompilerPhase<in Context : CommonBackendContext, Input, Output> {
|
||||||
fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Input>, context: Context, input: Input): Output
|
fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Input>, context: Context, input: Input): Output
|
||||||
|
|
||||||
fun getNamedSubphases(startDepth: Int = 0): List<Pair<Int, NamedCompilerPhase<Context, *>>> = emptyList()
|
fun getNamedSubphases(startDepth: Int = 0): List<Pair<Int, NamedCompilerPhase<Context, *>>> = emptyList()
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ typealias AnyNamedPhase = NamedCompilerPhase<*, *>
|
|||||||
enum class BeforeOrAfter { BEFORE, AFTER }
|
enum class BeforeOrAfter { BEFORE, AFTER }
|
||||||
|
|
||||||
data class ActionState(
|
data class ActionState(
|
||||||
val config: PhaseConfig,
|
val config: PhaseConfigurationService,
|
||||||
val phase: AnyNamedPhase,
|
val phase: AnyNamedPhase,
|
||||||
val phaseCount: Int,
|
val phaseCount: Int,
|
||||||
val beforeOrAfter: BeforeOrAfter
|
val beforeOrAfter: BeforeOrAfter
|
||||||
@@ -77,8 +77,8 @@ class NamedCompilerPhase<in Context : CommonBackendContext, Data>(
|
|||||||
private val actions: Set<Action<Data, Context>> = emptySet(),
|
private val actions: Set<Action<Data, Context>> = emptySet(),
|
||||||
private val nlevels: Int = 0
|
private val nlevels: Int = 0
|
||||||
) : SameTypeCompilerPhase<Context, Data> {
|
) : SameTypeCompilerPhase<Context, Data> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Data>, context: Context, input: Data): Data {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Data>, context: Context, input: Data): Data {
|
||||||
if (this !in phaseConfig.enabled) {
|
if (!phaseConfig.isEnabled(this)) {
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ class NamedCompilerPhase<in Context : CommonBackendContext, Data>(
|
|||||||
"Lowering $name: phases ${(prerequisite - phaserState.alreadyDone).map { it.name }} are required, but not satisfied"
|
"Lowering $name: phases ${(prerequisite - phaserState.alreadyDone).map { it.name }} are required, but not satisfied"
|
||||||
}
|
}
|
||||||
|
|
||||||
context.inVerbosePhase = this in phaseConfig.verbose
|
context.inVerbosePhase = phaseConfig.isVerbose(this)
|
||||||
|
|
||||||
runBefore(phaseConfig, phaserState, context, input)
|
runBefore(phaseConfig, phaserState, context, input)
|
||||||
val output = if (phaseConfig.needProfiling) {
|
val output = if (phaseConfig.needProfiling) {
|
||||||
@@ -104,7 +104,7 @@ class NamedCompilerPhase<in Context : CommonBackendContext, Data>(
|
|||||||
return output
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun runBefore(phaseConfig: PhaseConfig, phaserState: PhaserState<Data>, context: Context, input: Data) {
|
private fun runBefore(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Data>, context: Context, input: Data) {
|
||||||
val state = ActionState(phaseConfig, this, phaserState.phaseCount, BeforeOrAfter.BEFORE)
|
val state = ActionState(phaseConfig, this, phaserState.phaseCount, BeforeOrAfter.BEFORE)
|
||||||
for (action in actions) action(state, input, context)
|
for (action in actions) action(state, input, context)
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ class NamedCompilerPhase<in Context : CommonBackendContext, Data>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun runAfter(phaseConfig: PhaseConfig, phaserState: PhaserState<Data>, context: Context, output: Data) {
|
private fun runAfter(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Data>, context: Context, output: Data) {
|
||||||
val state = ActionState(phaseConfig, this, phaserState.phaseCount, BeforeOrAfter.AFTER)
|
val state = ActionState(phaseConfig, this, phaserState.phaseCount, BeforeOrAfter.AFTER)
|
||||||
for (action in actions) action(state, output, context)
|
for (action in actions) action(state, output, context)
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ class NamedCompilerPhase<in Context : CommonBackendContext, Data>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun runAndProfile(phaseConfig: PhaseConfig, phaserState: PhaserState<Data>, context: Context, source: Data): Data {
|
private fun runAndProfile(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Data>, context: Context, source: Data): Data {
|
||||||
var result: Data? = null
|
var result: Data? = null
|
||||||
val msec = measureTimeMillis {
|
val msec = measureTimeMillis {
|
||||||
result = phaserState.downlevel(nlevels) {
|
result = phaserState.downlevel(nlevels) {
|
||||||
|
|||||||
+6
-6
@@ -31,15 +31,15 @@ private val IrElement.elementName: String
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun ActionState.isDumpNeeded() =
|
private fun ActionState.isDumpNeeded() =
|
||||||
phase in when (beforeOrAfter) {
|
when (beforeOrAfter) {
|
||||||
BeforeOrAfter.BEFORE -> config.toDumpStateBefore
|
BeforeOrAfter.BEFORE -> config.shouldDumpStateBefore(phase)
|
||||||
BeforeOrAfter.AFTER -> config.toDumpStateAfter
|
BeforeOrAfter.AFTER -> config.shouldDumpStateAfter(phase)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ActionState.isValidationNeeded() =
|
private fun ActionState.isValidationNeeded() =
|
||||||
phase in when (beforeOrAfter) {
|
when (beforeOrAfter) {
|
||||||
BeforeOrAfter.BEFORE -> config.toValidateStateBefore
|
BeforeOrAfter.BEFORE -> config.shouldValidateStateBefore(phase)
|
||||||
BeforeOrAfter.AFTER -> config.toValidateStateAfter
|
BeforeOrAfter.AFTER -> config.shouldValidateStateAfter(phase)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <Data, Context> makeDumpAction(dumper: Action<Data, Context>): Action<Data, Context> =
|
fun <Data, Context> makeDumpAction(dumper: Action<Data, Context>): Action<Data, Context> =
|
||||||
|
|||||||
+8
-8
@@ -17,7 +17,7 @@ private class CompositePhase<Context : CommonBackendContext, Input, Output>(
|
|||||||
val phases: List<CompilerPhase<Context, Any?, Any?>>
|
val phases: List<CompilerPhase<Context, Any?, Any?>>
|
||||||
) : CompilerPhase<Context, Input, Output> {
|
) : CompilerPhase<Context, Input, Output> {
|
||||||
|
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Input>, context: Context, input: Input): Output {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Input>, context: Context, input: Input): Output {
|
||||||
@Suppress("UNCHECKED_CAST") var currentState = phaserState as PhaserState<Any?>
|
@Suppress("UNCHECKED_CAST") var currentState = phaserState as PhaserState<Any?>
|
||||||
var result = phases.first().invoke(phaseConfig, currentState, context, input)
|
var result = phases.first().invoke(phaseConfig, currentState, context, input)
|
||||||
for ((previous, next) in phases.zip(phases.drop(1))) {
|
for ((previous, next) in phases.zip(phases.drop(1))) {
|
||||||
@@ -65,7 +65,7 @@ fun <Context : CommonBackendContext, Element : IrElement> makeCustomPhase(
|
|||||||
private class CustomPhaseAdapter<Context : CommonBackendContext, Element>(
|
private class CustomPhaseAdapter<Context : CommonBackendContext, Element>(
|
||||||
private val op: (Context, Element) -> Unit
|
private val op: (Context, Element) -> Unit
|
||||||
) : SameTypeCompilerPhase<Context, Element> {
|
) : SameTypeCompilerPhase<Context, Element> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Element>, context: Context, input: Element): Element {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Element>, context: Context, input: Element): Element {
|
||||||
op(context, input)
|
op(context, input)
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ fun <Context : CommonBackendContext> namedOpUnitPhase(
|
|||||||
name, description, prerequisite,
|
name, description, prerequisite,
|
||||||
nlevels = 0,
|
nlevels = 0,
|
||||||
lower = object : SameTypeCompilerPhase<Context, Unit> {
|
lower = object : SameTypeCompilerPhase<Context, Unit> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
||||||
context.op()
|
context.op()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ fun <Context : CommonBackendContext> makeIrFilePhase(
|
|||||||
private class FileLoweringPhaseAdapter<Context : CommonBackendContext>(
|
private class FileLoweringPhaseAdapter<Context : CommonBackendContext>(
|
||||||
private val lowering: (Context) -> FileLoweringPass
|
private val lowering: (Context) -> FileLoweringPass
|
||||||
) : SameTypeCompilerPhase<Context, IrFile> {
|
) : SameTypeCompilerPhase<Context, IrFile> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<IrFile>, context: Context, input: IrFile): IrFile {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<IrFile>, context: Context, input: IrFile): IrFile {
|
||||||
lowering(context).lower(input)
|
lowering(context).lower(input)
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ private class ModuleLoweringPhaseAdapter<Context : CommonBackendContext>(
|
|||||||
private val lowering: (Context) -> FileLoweringPass
|
private val lowering: (Context) -> FileLoweringPass
|
||||||
) : SameTypeCompilerPhase<Context, IrModuleFragment> {
|
) : SameTypeCompilerPhase<Context, IrModuleFragment> {
|
||||||
override fun invoke(
|
override fun invoke(
|
||||||
phaseConfig: PhaseConfig, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment
|
phaseConfig: PhaseConfigurationService, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment
|
||||||
): IrModuleFragment {
|
): IrModuleFragment {
|
||||||
lowering(context).lower(input)
|
lowering(context).lower(input)
|
||||||
return input
|
return input
|
||||||
@@ -151,17 +151,17 @@ private class ModuleLoweringPhaseAdapter<Context : CommonBackendContext>(
|
|||||||
@Suppress("unused") // Used in kotlin-native
|
@Suppress("unused") // Used in kotlin-native
|
||||||
fun <Context : CommonBackendContext, Input> unitSink(): CompilerPhase<Context, Input, Unit> =
|
fun <Context : CommonBackendContext, Input> unitSink(): CompilerPhase<Context, Input, Unit> =
|
||||||
object : CompilerPhase<Context, Input, Unit> {
|
object : CompilerPhase<Context, Input, Unit> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Input>, context: Context, input: Input) {}
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Input>, context: Context, input: Input) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intermediate phases to change the object of transformations
|
// Intermediate phases to change the object of transformations
|
||||||
@Suppress("unused") // Used in kotlin-native
|
@Suppress("unused") // Used in kotlin-native
|
||||||
fun <Context : CommonBackendContext, OldData, NewData> takeFromContext(op: (Context) -> NewData): CompilerPhase<Context, OldData, NewData> =
|
fun <Context : CommonBackendContext, OldData, NewData> takeFromContext(op: (Context) -> NewData): CompilerPhase<Context, OldData, NewData> =
|
||||||
object : CompilerPhase<Context, OldData, NewData> {
|
object : CompilerPhase<Context, OldData, NewData> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<OldData>, context: Context, input: OldData) = op(context)
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<OldData>, context: Context, input: OldData) = op(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <Context : CommonBackendContext, OldData, NewData> transform(op: (OldData) -> NewData): CompilerPhase<Context, OldData, NewData> =
|
fun <Context : CommonBackendContext, OldData, NewData> transform(op: (OldData) -> NewData): CompilerPhase<Context, OldData, NewData> =
|
||||||
object : CompilerPhase<Context, OldData, NewData> {
|
object : CompilerPhase<Context, OldData, NewData> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<OldData>, context: Context, input: OldData) = op(input)
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<OldData>, context: Context, input: OldData) = op(input)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -44,9 +44,9 @@ class PhaseConfig(
|
|||||||
val toDumpStateAfter: Set<AnyNamedPhase> = emptySet(),
|
val toDumpStateAfter: Set<AnyNamedPhase> = emptySet(),
|
||||||
override val dumpToDirectory: String? = null,
|
override val dumpToDirectory: String? = null,
|
||||||
override val dumpOnlyFqName: String? = null,
|
override val dumpOnlyFqName: String? = null,
|
||||||
val toValidateStateBefore: Set<AnyNamedPhase> = emptySet(),
|
private val toValidateStateBefore: Set<AnyNamedPhase> = emptySet(),
|
||||||
val toValidateStateAfter: Set<AnyNamedPhase> = emptySet(),
|
private val toValidateStateAfter: Set<AnyNamedPhase> = emptySet(),
|
||||||
val namesOfElementsExcludedFromDumping: Set<String> = emptySet(),
|
private val namesOfElementsExcludedFromDumping: Set<String> = emptySet(),
|
||||||
override val needProfiling: Boolean = false,
|
override val needProfiling: Boolean = false,
|
||||||
override val checkConditions: Boolean = false,
|
override val checkConditions: Boolean = false,
|
||||||
override val checkStickyConditions: Boolean = false
|
override val checkStickyConditions: Boolean = false
|
||||||
|
|||||||
+3
-3
@@ -43,7 +43,7 @@ private class PerformByIrFilePhase<Context : CommonBackendContext>(
|
|||||||
private val copyBeforeLowering: Boolean,
|
private val copyBeforeLowering: Boolean,
|
||||||
) : SameTypeCompilerPhase<Context, IrModuleFragment> {
|
) : SameTypeCompilerPhase<Context, IrModuleFragment> {
|
||||||
override fun invoke(
|
override fun invoke(
|
||||||
phaseConfig: PhaseConfig,
|
phaseConfig: PhaseConfigurationService,
|
||||||
phaserState: PhaserState<IrModuleFragment>,
|
phaserState: PhaserState<IrModuleFragment>,
|
||||||
context: Context,
|
context: Context,
|
||||||
input: IrModuleFragment
|
input: IrModuleFragment
|
||||||
@@ -56,7 +56,7 @@ private class PerformByIrFilePhase<Context : CommonBackendContext>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun invokeSequential(
|
private fun invokeSequential(
|
||||||
phaseConfig: PhaseConfig, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment
|
phaseConfig: PhaseConfigurationService, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment
|
||||||
): IrModuleFragment {
|
): IrModuleFragment {
|
||||||
for (irFile in input.files) {
|
for (irFile in input.files) {
|
||||||
try {
|
try {
|
||||||
@@ -74,7 +74,7 @@ private class PerformByIrFilePhase<Context : CommonBackendContext>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun invokeParallel(
|
private fun invokeParallel(
|
||||||
phaseConfig: PhaseConfig, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment, nThreads: Int
|
phaseConfig: PhaseConfigurationService, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment, nThreads: Int
|
||||||
): IrModuleFragment {
|
): IrModuleFragment {
|
||||||
if (input.files.isEmpty()) return input
|
if (input.files.isEmpty()) return input
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ private fun makeCustomJsModulePhase(
|
|||||||
prerequisite = prerequisite,
|
prerequisite = prerequisite,
|
||||||
lower = object : SameTypeCompilerPhase<JsIrBackendContext, Iterable<IrModuleFragment>> {
|
lower = object : SameTypeCompilerPhase<JsIrBackendContext, Iterable<IrModuleFragment>> {
|
||||||
override fun invoke(
|
override fun invoke(
|
||||||
phaseConfig: PhaseConfig,
|
phaseConfig: PhaseConfigurationService,
|
||||||
phaserState: PhaserState<Iterable<IrModuleFragment>>,
|
phaserState: PhaserState<Iterable<IrModuleFragment>>,
|
||||||
context: JsIrBackendContext,
|
context: JsIrBackendContext,
|
||||||
input: Iterable<IrModuleFragment>
|
input: Iterable<IrModuleFragment>
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ private fun makeCustomWasmModulePhase(
|
|||||||
prerequisite = prerequisite,
|
prerequisite = prerequisite,
|
||||||
lower = object : SameTypeCompilerPhase<WasmBackendContext, Iterable<IrModuleFragment>> {
|
lower = object : SameTypeCompilerPhase<WasmBackendContext, Iterable<IrModuleFragment>> {
|
||||||
override fun invoke(
|
override fun invoke(
|
||||||
phaseConfig: PhaseConfig,
|
phaseConfig: PhaseConfigurationService,
|
||||||
phaserState: PhaserState<Iterable<IrModuleFragment>>,
|
phaserState: PhaserState<Iterable<IrModuleFragment>>,
|
||||||
context: WasmBackendContext,
|
context: WasmBackendContext,
|
||||||
input: Iterable<IrModuleFragment>
|
input: Iterable<IrModuleFragment>
|
||||||
|
|||||||
+2
-3
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.ir.declarations.IrFunction
|
|||||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
|
||||||
|
|
||||||
private val validateAll = false
|
private val validateAll = false
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ internal fun makeKonanFileOpPhase(
|
|||||||
) = NamedCompilerPhase(
|
) = NamedCompilerPhase(
|
||||||
name, description, prerequisite, nlevels = 0,
|
name, description, prerequisite, nlevels = 0,
|
||||||
lower = object : SameTypeCompilerPhase<Context, IrFile> {
|
lower = object : SameTypeCompilerPhase<Context, IrFile> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<IrFile>, context: Context, input: IrFile): IrFile {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<IrFile>, context: Context, input: IrFile): IrFile {
|
||||||
op(context, input)
|
op(context, input)
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
@@ -75,7 +74,7 @@ internal fun makeKonanModuleOpPhase(
|
|||||||
) = NamedCompilerPhase(
|
) = NamedCompilerPhase(
|
||||||
name, description, prerequisite, nlevels = 0,
|
name, description, prerequisite, nlevels = 0,
|
||||||
lower = object : SameTypeCompilerPhase<Context, IrModuleFragment> {
|
lower = object : SameTypeCompilerPhase<Context, IrModuleFragment> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment): IrModuleFragment {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment): IrModuleFragment {
|
||||||
op(context, input)
|
op(context, input)
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -303,7 +303,7 @@ internal val dependenciesLowerPhase = NamedCompilerPhase(
|
|||||||
description = "Lower library's IR",
|
description = "Lower library's IR",
|
||||||
prerequisite = emptySet(),
|
prerequisite = emptySet(),
|
||||||
lower = object : CompilerPhase<Context, IrModuleFragment, IrModuleFragment> {
|
lower = object : CompilerPhase<Context, IrModuleFragment, IrModuleFragment> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment): IrModuleFragment {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<IrModuleFragment>, context: Context, input: IrModuleFragment): IrModuleFragment {
|
||||||
val files = mutableListOf<IrFile>()
|
val files = mutableListOf<IrFile>()
|
||||||
files += input.files
|
files += input.files
|
||||||
input.files.clear()
|
input.files.clear()
|
||||||
@@ -341,7 +341,7 @@ internal val umbrellaCompilation = NamedCompilerPhase(
|
|||||||
description = "A batched compilation with shared FE and ME phases",
|
description = "A batched compilation with shared FE and ME phases",
|
||||||
prerequisite = emptySet(),
|
prerequisite = emptySet(),
|
||||||
lower = object : CompilerPhase<Context, Unit, Unit> {
|
lower = object : CompilerPhase<Context, Unit, Unit> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
||||||
val module = context.irModules.values.single()
|
val module = context.irModules.values.single()
|
||||||
|
|
||||||
val files = module.files.toList()
|
val files = module.files.toList()
|
||||||
@@ -440,7 +440,7 @@ internal val createGenerationStatePhase = namedUnitPhase(
|
|||||||
name = "CreateGenerationState",
|
name = "CreateGenerationState",
|
||||||
description = "Create generation state",
|
description = "Create generation state",
|
||||||
lower = object : CompilerPhase<Context, Unit, Unit> {
|
lower = object : CompilerPhase<Context, Unit, Unit> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
||||||
context.generationState = NativeGenerationState(context)
|
context.generationState = NativeGenerationState(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ internal val disposeGenerationStatePhase = namedUnitPhase(
|
|||||||
name = "DisposeGenerationState",
|
name = "DisposeGenerationState",
|
||||||
description = "Dispose generation state",
|
description = "Dispose generation state",
|
||||||
lower = object : CompilerPhase<Context, Unit, Unit> {
|
lower = object : CompilerPhase<Context, Unit, Unit> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
||||||
context.disposeGenerationState()
|
context.disposeGenerationState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-5
@@ -6,10 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.backend.konan.llvm
|
package org.jetbrains.kotlin.backend.konan.llvm
|
||||||
|
|
||||||
import llvm.*
|
import llvm.*
|
||||||
import org.jetbrains.kotlin.backend.common.phaser.CompilerPhase
|
import org.jetbrains.kotlin.backend.common.phaser.*
|
||||||
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
|
||||||
import org.jetbrains.kotlin.backend.common.phaser.PhaserState
|
|
||||||
import org.jetbrains.kotlin.backend.common.phaser.namedUnitPhase
|
|
||||||
import org.jetbrains.kotlin.backend.konan.*
|
import org.jetbrains.kotlin.backend.konan.*
|
||||||
import org.jetbrains.kotlin.backend.konan.descriptors.GlobalHierarchyAnalysis
|
import org.jetbrains.kotlin.backend.konan.descriptors.GlobalHierarchyAnalysis
|
||||||
import org.jetbrains.kotlin.backend.konan.llvm.coverage.runCoveragePass
|
import org.jetbrains.kotlin.backend.konan.llvm.coverage.runCoveragePass
|
||||||
@@ -308,7 +305,7 @@ internal val produceOutputPhase = namedUnitPhase(
|
|||||||
name = "ProduceOutput",
|
name = "ProduceOutput",
|
||||||
description = "Produce output",
|
description = "Produce output",
|
||||||
lower = object : CompilerPhase<Context, Unit, Unit> {
|
lower = object : CompilerPhase<Context, Unit, Unit> {
|
||||||
override fun invoke(phaseConfig: PhaseConfig, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
override fun invoke(phaseConfig: PhaseConfigurationService, phaserState: PhaserState<Unit>, context: Context, input: Unit) {
|
||||||
produceOutput(context)
|
produceOutput(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user