Drop -Xrepeat flag

This flag hadn't been maintained for a long time and isn't working
properly at the moment.
This commit is contained in:
Dmitry Savvinov
2018-03-28 18:21:46 +03:00
parent e3073be726
commit c3745c9040
6 changed files with 20 additions and 66 deletions
@@ -71,14 +71,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
@Argument(value = "-Xno-inline", description = "Disable method inlining") @Argument(value = "-Xno-inline", description = "Disable method inlining")
var noInline: Boolean by FreezableVar(false) var noInline: Boolean by FreezableVar(false)
// TODO Remove in 1.0
@Argument(
value = "-Xrepeat",
valueDescription = "<count>",
description = "Repeat compilation (for performance analysis)"
)
var repeat: String? by FreezableVar(null)
@Argument( @Argument(
value = "-Xskip-metadata-version-check", value = "-Xskip-metadata-version-check",
description = "Load classes with bad metadata version anyway (incl. pre-release classes)" description = "Load classes with bad metadata version anyway (incl. pre-release classes)"
@@ -82,50 +82,32 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
return ExitCode.COMPILATION_ERROR; return ExitCode.COMPILATION_ERROR;
} }
ExitCode exitCode = OK;
int repeatCount = 1;
String repeat = arguments.getRepeat();
if (repeat != null) {
try {
repeatCount = Integer.parseInt(repeat);
}
catch (NumberFormatException ignored) {
}
}
CompilationCanceledStatus canceledStatus = services.get(CompilationCanceledStatus.class); CompilationCanceledStatus canceledStatus = services.get(CompilationCanceledStatus.class);
ProgressIndicatorAndCompilationCanceledStatus.setCompilationCanceledStatus(canceledStatus); ProgressIndicatorAndCompilationCanceledStatus.setCompilationCanceledStatus(canceledStatus);
for (int i = 0; i < repeatCount; i++) { Disposable rootDisposable = Disposer.newDisposable();
if (i > 0) { try {
K2JVMCompiler.Companion.resetInitStartTime(); setIdeaIoUseFallback();
} ExitCode code = doExecute(arguments, configuration, rootDisposable, paths);
Disposable rootDisposable = Disposer.newDisposable(); return groupingCollector.hasErrors() ? COMPILATION_ERROR : code;
try { }
setIdeaIoUseFallback(); catch (CompilationCanceledException e) {
ExitCode code = doExecute(arguments, configuration, rootDisposable, paths); messageCollector.report(INFO, "Compilation was canceled", null);
exitCode = groupingCollector.hasErrors() ? COMPILATION_ERROR : code; return ExitCode.OK;
} }
catch (CompilationCanceledException e) { catch (RuntimeException e) {
Throwable cause = e.getCause();
if (cause instanceof CompilationCanceledException) {
messageCollector.report(INFO, "Compilation was canceled", null); messageCollector.report(INFO, "Compilation was canceled", null);
return ExitCode.OK; return ExitCode.OK;
} }
catch (RuntimeException e) { else {
Throwable cause = e.getCause(); throw e;
if (cause instanceof CompilationCanceledException) {
messageCollector.report(INFO, "Compilation was canceled", null);
return ExitCode.OK;
}
else {
throw e;
}
}
finally {
Disposer.dispose(rootDisposable);
} }
} }
return exitCode; finally {
Disposer.dispose(rootDisposable);
}
} }
catch (AnalysisResult.CompilationErrorException e) { catch (AnalysisResult.CompilationErrorException e) {
return COMPILATION_ERROR; return COMPILATION_ERROR;
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.cli.common.arguments.validateArguments
import org.jetbrains.kotlin.cli.common.messages.* import org.jetbrains.kotlin.cli.common.messages.*
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.STRONG_WARNING import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.STRONG_WARNING
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
import org.jetbrains.kotlin.cli.jvm.compiler.CompileEnvironmentException import org.jetbrains.kotlin.cli.jvm.compiler.CompileEnvironmentException
import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.Services import org.jetbrains.kotlin.config.Services
@@ -44,8 +43,6 @@ abstract class CLITool<A : CommonToolArguments> {
messageRenderer: MessageRenderer, messageRenderer: MessageRenderer,
args: Array<out String> args: Array<out String>
): ExitCode { ): ExitCode {
K2JVMCompiler.resetInitStartTime()
val arguments = createArguments() val arguments = createArguments()
parseCommandLineArguments(args.asList(), arguments) parseCommandLineArguments(args.asList(), arguments)
val collector = PrintingMessageCollector(errStream, messageRenderer, arguments.verbose) val collector = PrintingMessageCollector(errStream, messageRenderer, arguments.verbose)
@@ -345,15 +345,6 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
companion object { companion object {
private var initStartNanos = System.nanoTime() private var initStartNanos = System.nanoTime()
// allows to track GC time for each run when repeated compilation is used
private val elapsedGCTime = hashMapOf<String, Long>()
private var elapsedJITTime = 0L
fun resetInitStartTime() {
if (initStartNanos == 0L) {
initStartNanos = System.nanoTime()
}
}
@JvmStatic @JvmStatic
fun main(args: Array<String>) { fun main(args: Array<String>) {
@@ -368,19 +359,13 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
fun reportGCTime(configuration: CompilerConfiguration) { fun reportGCTime(configuration: CompilerConfiguration) {
ManagementFactory.getGarbageCollectorMXBeans().forEach { ManagementFactory.getGarbageCollectorMXBeans().forEach {
val currentTime = it.collectionTime reportPerf(configuration, "GC time for ${it.name} is ${it.collectionTime} ms")
val elapsedTime = elapsedGCTime.getOrElse(it.name) { 0 }
val time = currentTime - elapsedTime
reportPerf(configuration, "GC time for ${it.name} is $time ms")
elapsedGCTime[it.name] = currentTime
} }
} }
fun reportCompilationTime(configuration: CompilerConfiguration) { fun reportCompilationTime(configuration: CompilerConfiguration) {
val bean = ManagementFactory.getCompilationMXBean() ?: return val bean = ManagementFactory.getCompilationMXBean() ?: return
val currentTime = bean.totalCompilationTime reportPerf(configuration, "JIT time is ${bean.totalCompilationTime} ms")
reportPerf(configuration, "JIT time is ${currentTime - elapsedJITTime} ms")
elapsedJITTime = currentTime
} }
private fun putAdvancedOptions(configuration: CompilerConfiguration, arguments: K2JVMCompilerArguments) { private fun putAdvancedOptions(configuration: CompilerConfiguration, arguments: K2JVMCompilerArguments) {
-1
View File
@@ -17,7 +17,6 @@ where advanced options include:
-Xplugin=<path> Load plugins from the given classpath -Xplugin=<path> Load plugins from the given classpath
-Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types -Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types
-Xread-deserialized-contracts Enable reading of contracts from metadata -Xread-deserialized-contracts Enable reading of contracts from metadata
-Xrepeat=<count> Repeat compilation (for performance analysis)
-Xreport-output-files Report source to output files mapping -Xreport-output-files Report source to output files mapping
-Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes) -Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes)
-Xuse-experimental=<fq.name> Enable usages of COMPILATION-affecting experimental API for marker annotation with the given fully qualified name -Xuse-experimental=<fq.name> Enable usages of COMPILATION-affecting experimental API for marker annotation with the given fully qualified name
-1
View File
@@ -59,7 +59,6 @@ where advanced options include:
-Xplugin=<path> Load plugins from the given classpath -Xplugin=<path> Load plugins from the given classpath
-Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types -Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types
-Xread-deserialized-contracts Enable reading of contracts from metadata -Xread-deserialized-contracts Enable reading of contracts from metadata
-Xrepeat=<count> Repeat compilation (for performance analysis)
-Xreport-output-files Report source to output files mapping -Xreport-output-files Report source to output files mapping
-Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes) -Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes)
-Xuse-experimental=<fq.name> Enable usages of COMPILATION-affecting experimental API for marker annotation with the given fully qualified name -Xuse-experimental=<fq.name> Enable usages of COMPILATION-affecting experimental API for marker annotation with the given fully qualified name