Skip to content

Commit 2816d55

Browse files
ivandev0Space Team
authored and
Space Team
committed
[CLI] Include klib generation into IR translation time measurements
#KT-67473
1 parent f3cd3b1 commit 2816d55

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,10 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
330330
return OK
331331
}
332332

333-
if (!arguments.irProduceJs) return OK
333+
if (!arguments.irProduceJs) {
334+
performanceManager?.notifyIRTranslationFinished()
335+
return OK
336+
}
334337

335338
messageCollector.report(INFO, "Produce executable: $outputDirPath")
336339
messageCollector.report(INFO, "Cache directory: ${arguments.cacheDirectory}")
@@ -368,6 +371,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
368371
messageCollector.report(INFO, "IC module builder rebuilt JS for module [${File(module).name}]")
369372
}
370373

374+
performanceManager?.notifyIRTranslationFinished()
371375
return OK
372376
}
373377

@@ -612,6 +616,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
612616
}
613617

614618
// FIR2IR
619+
performanceManager?.notifyIRTranslationStarted()
615620
val fir2IrActualizedResult = transformFirToIr(moduleStructure, analyzedOutput.output, diagnosticsReporter)
616621
FirDiagnosticsCompilerResultsReporter.reportToMessageCollector(diagnosticsReporter, messageCollector, true)
617622
if (diagnosticsReporter.hasErrors) {

compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/compilerPipeline.kt

-6
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ fun transformFirToIr(
231231
}
232232

233233
val firResult = FirResult(firOutputs)
234-
235-
val performanceManager = moduleStructure.compilerConfiguration[CLIConfigurationKeys.PERF_MANAGER]
236-
performanceManager?.notifyIRTranslationStarted()
237-
238234
return firResult.convertToIrAndActualize(
239235
fir2IrExtensions,
240236
Fir2IrConfiguration.forKlibCompilation(moduleStructure.compilerConfiguration, diagnosticsReporter),
@@ -247,8 +243,6 @@ fun transformFirToIr(
247243
specialAnnotationsProvider = null,
248244
) { irModuleFragment ->
249245
(irModuleFragment.descriptor as? FirModuleDescriptor)?.let { it.allDependencyModules = librariesDescriptors }
250-
}.also {
251-
performanceManager?.notifyIRTranslationFinished()
252246
}
253247
}
254248

compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/klib/irForKlib.kt

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.backend.common.serialization.KotlinFileSerializedDat
2323
import org.jetbrains.kotlin.backend.common.serialization.mangle.ManglerChecker
2424
import org.jetbrains.kotlin.backend.common.serialization.mangle.descriptor.Ir2DescriptorManglerAdapter
2525
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDescriptor
26+
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
2627
import org.jetbrains.kotlin.config.CompilerConfiguration
2728
import org.jetbrains.kotlin.config.languageVersionSettings
2829
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
@@ -55,6 +56,9 @@ fun generateIrForKlibSerialization(
5556
verifySignatures: Boolean = true,
5657
getDescriptorByLibrary: (KotlinLibrary) -> ModuleDescriptor,
5758
): Pair<IrModuleFragment, IrPluginContext> {
59+
val performanceManager = configuration[CLIConfigurationKeys.PERF_MANAGER]
60+
performanceManager?.notifyIRTranslationStarted()
61+
5862
val errorPolicy = configuration.get(JSConfigurationKeys.ERROR_TOLERANCE_POLICY) ?: ErrorTolerancePolicy.DEFAULT
5963
val messageLogger = configuration.get(IrMessageLogger.IR_MESSAGE_LOGGER) ?: IrMessageLogger.None
6064
val symbolTable = SymbolTable(IdSignatureDescriptor(JsManglerDesc), irFactory)

compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt

-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ fun compile(
4949
filesToLower: Set<String>? = null,
5050
granularity: JsGenerationGranularity = JsGenerationGranularity.WHOLE_PROGRAM,
5151
): LoweredIr {
52-
val performanceManager = depsDescriptors.compilerConfiguration[CLIConfigurationKeys.PERF_MANAGER]
53-
performanceManager?.notifyIRTranslationStarted()
54-
5552
val (moduleFragment: IrModuleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer, moduleToName) =
5653
loadIr(depsDescriptors, irFactory, verifySignatures, filesToLower, loadFunctionInterfacesIntoStdlib = true)
5754

compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ fun compileToLoweredIr(
6767
val mainModule = depsDescriptors.mainModule
6868
val configuration = depsDescriptors.compilerConfiguration
6969
val performanceManager = depsDescriptors.compilerConfiguration[CLIConfigurationKeys.PERF_MANAGER]
70-
performanceManager?.notifyIRTranslationStarted()
7170

7271
val (moduleFragment, dependencyModules, irBuiltIns, symbolTable, irLinker) = loadIr(
7372
depsDescriptors,

0 commit comments

Comments
 (0)