[K2] Move Generation perf calculation inside generateCodeFromIr

1. We don't need to include `GenerationState` initialization time
2. We don't need to include diagnostic reporting time
This commit is contained in:
Ivan Kylchik
2024-03-05 15:38:20 +01:00
committed by Space Team
parent fd961452b3
commit 1eabff337d
3 changed files with 4 additions and 11 deletions
@@ -158,7 +158,6 @@ object FirKotlinToJvmBytecodeCompiler {
val fir2IrAndIrActualizerResult =
firResult.convertToIrAndActualizeForJvm(fir2IrExtensions, configuration, diagnosticsReporter, irGenerationExtensions)
performanceManager?.notifyGenerationStarted()
val generationState = runBackend(
fir2IrExtensions,
fir2IrAndIrActualizerResult,
@@ -167,8 +166,6 @@ object FirKotlinToJvmBytecodeCompiler {
FirDiagnosticsCompilerResultsReporter.reportToMessageCollector(diagnosticsReporter, messageCollector, renderDiagnosticNames)
performanceManager?.notifyIRGenerationFinished()
performanceManager?.notifyGenerationFinished()
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
return firResult to generationState
@@ -136,16 +136,12 @@ fun compileModulesUsingFrontendIrAndLightTree(
val compilerEnvironment = ModuleCompilerEnvironment(projectEnvironment, diagnosticsReporter)
val irInput = convertAnalyzedFirToIr(compilerInput, analysisResults, compilerEnvironment)
performanceManager?.notifyGenerationStarted()
val codegenOutput = generateCodeFromIr(irInput, compilerEnvironment, performanceManager)
diagnosticsReporter.reportToMessageCollector(
messageCollector, moduleConfiguration.getBoolean(CLIConfigurationKeys.RENDER_DIAGNOSTIC_INTERNAL_NAME)
)
performanceManager?.notifyIRGenerationFinished()
performanceManager?.notifyGenerationFinished()
return writeOutputsIfNeeded(
project,
compilerConfiguration,
@@ -236,6 +232,7 @@ fun generateCodeFromIr(
environment.diagnosticsReporter
).build()
performanceManager?.notifyGenerationStarted()
performanceManager?.notifyIRLoweringStarted()
generationState.beforeCompile()
codegenFactory.generateModuleInFrontendIRMode(
@@ -255,6 +252,9 @@ fun generateCodeFromIr(
}
CodegenFactory.doCheckCancelled(generationState)
generationState.factory.done()
performanceManager?.notifyIRGenerationFinished()
performanceManager?.notifyGenerationFinished()
return ModuleCompilerOutput(generationState)
}
@@ -269,7 +269,6 @@ open class IncrementalFirJvmCompilerRunner(
extensions, configuration, compilerEnvironment.diagnosticsReporter, irGenerationExtensions,
)
performanceManager?.notifyGenerationStarted()
val irInput = ModuleCompilerIrBackendInput(
targetId,
configuration,
@@ -282,9 +281,6 @@ open class IncrementalFirJvmCompilerRunner(
val codegenOutput = generateCodeFromIr(irInput, compilerEnvironment, performanceManager)
performanceManager?.notifyIRGenerationFinished()
performanceManager?.notifyGenerationFinished()
diagnosticsReporter.reportToMessageCollector(messageCollector, renderDiagnosticName)
writeOutputsIfNeeded(