FIR: report lowering time from JvmIrCodegenFactory
This commit is contained in:
@@ -22,6 +22,7 @@ abstract class CommonCompilerPerformanceManager(private val presentableName: Str
|
|||||||
private var startGCData = mutableMapOf<String, GCData>()
|
private var startGCData = mutableMapOf<String, GCData>()
|
||||||
|
|
||||||
private var irTranslationStart: Long = 0
|
private var irTranslationStart: Long = 0
|
||||||
|
private var irLoweringStart: Long = 0
|
||||||
private var irGenerationStart: Long = 0
|
private var irGenerationStart: Long = 0
|
||||||
|
|
||||||
private var targetDescription: String? = null
|
private var targetDescription: String? = null
|
||||||
@@ -88,6 +89,19 @@ abstract class CommonCompilerPerformanceManager(private val presentableName: Str
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun notifyIRLoweringStarted() {
|
||||||
|
irLoweringStart = PerformanceCounter.currentTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun notifyIRLoweringFinished() {
|
||||||
|
val time = deltaTime(irLoweringStart)
|
||||||
|
measurements += IRMeasurement(
|
||||||
|
lines,
|
||||||
|
TimeUnit.NANOSECONDS.toMillis(time),
|
||||||
|
IRMeasurement.Kind.LOWERING
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
open fun notifyIRGenerationStarted() {
|
open fun notifyIRGenerationStarted() {
|
||||||
irGenerationStart = PerformanceCounter.currentTime()
|
irGenerationStart = PerformanceCounter.currentTime()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class IRMeasurement(val lines: Int?, val milliseconds: Long, val kind: Kind) : P
|
|||||||
override fun render(): String = formatMeasurement("IR $kind", milliseconds, lines)
|
override fun render(): String = formatMeasurement("IR $kind", milliseconds, lines)
|
||||||
|
|
||||||
enum class Kind {
|
enum class Kind {
|
||||||
TRANSLATION, GENERATION
|
TRANSLATION, LOWERING, GENERATION
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -387,10 +387,14 @@ object KotlinToJVMBytecodeCompiler {
|
|||||||
|
|
||||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||||
|
|
||||||
performanceManager?.notifyIRGenerationStarted()
|
performanceManager?.notifyIRLoweringStarted()
|
||||||
generationState.beforeCompile()
|
generationState.beforeCompile()
|
||||||
codegenFactory.generateModuleInFrontendIRMode(
|
codegenFactory.generateModuleInFrontendIRMode(
|
||||||
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components)
|
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components),
|
||||||
|
{
|
||||||
|
performanceManager?.notifyIRLoweringFinished()
|
||||||
|
performanceManager?.notifyIRGenerationStarted()
|
||||||
|
}
|
||||||
)
|
)
|
||||||
CodegenFactory.doCheckCancelled(generationState)
|
CodegenFactory.doCheckCancelled(generationState)
|
||||||
generationState.factory.done()
|
generationState.factory.done()
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
val irProviders: List<IrProvider>,
|
val irProviders: List<IrProvider>,
|
||||||
val extensions: JvmGeneratorExtensions,
|
val extensions: JvmGeneratorExtensions,
|
||||||
val backendExtension: JvmBackendExtension,
|
val backendExtension: JvmBackendExtension,
|
||||||
|
val notifyCodegenStart: () -> Unit,
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun generateModule(state: GenerationState, files: Collection<KtFile>) {
|
override fun generateModule(state: GenerationState, files: Collection<KtFile>) {
|
||||||
@@ -158,6 +159,7 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
irProviders,
|
irProviders,
|
||||||
extensions,
|
extensions,
|
||||||
JvmBackendExtension.Default,
|
JvmBackendExtension.Default,
|
||||||
|
{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +175,7 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun doGenerateFilesInternal(input: JvmIrBackendInput) {
|
fun doGenerateFilesInternal(input: JvmIrBackendInput) {
|
||||||
val (state, irModuleFragment, symbolTable, sourceManager, phaseConfig, irProviders, extensions, backendExtension) = input
|
val (state, irModuleFragment, symbolTable, sourceManager, phaseConfig, irProviders, extensions, backendExtension, notifyCodegenStart) = input
|
||||||
val context = JvmBackendContext(
|
val context = JvmBackendContext(
|
||||||
state, sourceManager, irModuleFragment.irBuiltins, irModuleFragment,
|
state, sourceManager, irModuleFragment.irBuiltins, irModuleFragment,
|
||||||
symbolTable, phaseConfig, extensions, backendExtension
|
symbolTable, phaseConfig, extensions, backendExtension
|
||||||
@@ -189,6 +191,8 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
|
|
||||||
JvmLower(context).lower(irModuleFragment)
|
JvmLower(context).lower(irModuleFragment)
|
||||||
|
|
||||||
|
notifyCodegenStart()
|
||||||
|
|
||||||
for (generateMultifileFacade in listOf(true, false)) {
|
for (generateMultifileFacade in listOf(true, false)) {
|
||||||
for (irFile in irModuleFragment.files) {
|
for (irFile in irModuleFragment.files) {
|
||||||
// Generate multifile facades first, to compute and store JVM signatures of const properties which are later used
|
// Generate multifile facades first, to compute and store JVM signatures of const properties which are later used
|
||||||
@@ -221,10 +225,11 @@ class JvmIrCodegenFactory(private val phaseConfig: PhaseConfig) : CodegenFactory
|
|||||||
sourceManager: PsiSourceManager,
|
sourceManager: PsiSourceManager,
|
||||||
extensions: JvmGeneratorExtensions,
|
extensions: JvmGeneratorExtensions,
|
||||||
backendExtension: JvmBackendExtension,
|
backendExtension: JvmBackendExtension,
|
||||||
|
notifyCodegenStart: () -> Unit
|
||||||
) {
|
) {
|
||||||
val irProviders = configureBuiltInsAndgenerateIrProvidersInFrontendIRMode(irModuleFragment, symbolTable, extensions)
|
val irProviders = configureBuiltInsAndgenerateIrProvidersInFrontendIRMode(irModuleFragment, symbolTable, extensions)
|
||||||
doGenerateFilesInternal(
|
doGenerateFilesInternal(
|
||||||
JvmIrBackendInput(state, irModuleFragment, symbolTable, sourceManager, phaseConfig, irProviders, extensions, backendExtension)
|
JvmIrBackendInput(state, irModuleFragment, symbolTable, sourceManager, phaseConfig, irProviders, extensions, backendExtension, notifyCodegenStart)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -91,7 +91,8 @@ class Fir2IrResultsConverter(
|
|||||||
phaseConfig,
|
phaseConfig,
|
||||||
irProviders,
|
irProviders,
|
||||||
extensions,
|
extensions,
|
||||||
FirJvmBackendExtension(inputArtifact.session, components)
|
FirJvmBackendExtension(inputArtifact.session, components),
|
||||||
|
{},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ object GenerationUtils {
|
|||||||
|
|
||||||
generationState.beforeCompile()
|
generationState.beforeCompile()
|
||||||
codegenFactory.generateModuleInFrontendIRMode(
|
codegenFactory.generateModuleInFrontendIRMode(
|
||||||
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components),
|
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components), {},
|
||||||
)
|
)
|
||||||
|
|
||||||
generationState.factory.done()
|
generationState.factory.done()
|
||||||
|
|||||||
Reference in New Issue
Block a user