From 5bd405856f021bd7dcae8c9f7dbc83b3fcb0579d Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Thu, 19 Jan 2023 12:53:11 +0200 Subject: [PATCH] [IR] Pass input value to AbstractNamedCompilerPhase.runAfter It is needed for the K/N dynamic compiler driver where phase input might be required for actions performed after its execution. --- .../kotlin/backend/common/phaser/CompilerPhase.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/CompilerPhase.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/CompilerPhase.kt index 4cfb622c06d..578c6ecb7db 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/CompilerPhase.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/phaser/CompilerPhase.kt @@ -94,7 +94,7 @@ abstract class AbstractNamedCompilerPhase, context: Context, input: Input) - abstract fun runAfter(phaseConfig: PhaseConfigurationService, phaserState: PhaserState, context: Context, output: Output) + abstract fun runAfter(phaseConfig: PhaseConfigurationService, phaserState: PhaserState, context: Context, input: Input, output: Output) private fun runAndProfile(phaseConfig: PhaseConfigurationService, phaserState: PhaserState, context: Context, source: Input): Output { var result: Output? = null @@ -161,7 +161,7 @@ class NamedCompilerPhase( } } - override fun runAfter(phaseConfig: PhaseConfigurationService, phaserState: PhaserState, context: Context, output: Data) { + override fun runAfter(phaseConfig: PhaseConfigurationService, phaserState: PhaserState, context: Context, input: Data, output: Data) { val state = ActionState(phaseConfig, this, phaserState.phaseCount, BeforeOrAfter.AFTER) for (action in actions) action(state, output, context) @@ -193,7 +193,7 @@ abstract class SimpleNamedCompilerPhase> = emptySet(), postconditions: Set> = emptySet(), private val preactions: Set> = emptySet(), - private val postactions: Set> = emptySet(), + private val postactions: Set, Context>> = emptySet(), nlevels: Int = 0, ) : AbstractNamedCompilerPhase( name, @@ -220,9 +220,9 @@ abstract class SimpleNamedCompilerPhase, context: Context, output: Output) { + override fun runAfter(phaseConfig: PhaseConfigurationService, phaserState: PhaserState, context: Context, input: Input, output: Output) { val state = ActionState(phaseConfig, this, phaserState.phaseCount, BeforeOrAfter.AFTER) - for (action in postactions) action(state, output, context) + for (action in postactions) action(state, input to output, context) if (phaseConfig.checkConditions) { for (post in postconditions) post(output)