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")
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(
value = "-Xskip-metadata-version-check",
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;
}
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);
ProgressIndicatorAndCompilationCanceledStatus.setCompilationCanceledStatus(canceledStatus);
for (int i = 0; i < repeatCount; i++) {
if (i > 0) {
K2JVMCompiler.Companion.resetInitStartTime();
}
Disposable rootDisposable = Disposer.newDisposable();
try {
setIdeaIoUseFallback();
ExitCode code = doExecute(arguments, configuration, rootDisposable, paths);
exitCode = groupingCollector.hasErrors() ? COMPILATION_ERROR : code;
}
catch (CompilationCanceledException e) {
Disposable rootDisposable = Disposer.newDisposable();
try {
setIdeaIoUseFallback();
ExitCode code = doExecute(arguments, configuration, rootDisposable, paths);
return groupingCollector.hasErrors() ? COMPILATION_ERROR : code;
}
catch (CompilationCanceledException e) {
messageCollector.report(INFO, "Compilation was canceled", null);
return ExitCode.OK;
}
catch (RuntimeException e) {
Throwable cause = e.getCause();
if (cause instanceof CompilationCanceledException) {
messageCollector.report(INFO, "Compilation was canceled", null);
return ExitCode.OK;
}
catch (RuntimeException e) {
Throwable cause = e.getCause();
if (cause instanceof CompilationCanceledException) {
messageCollector.report(INFO, "Compilation was canceled", null);
return ExitCode.OK;
}
else {
throw e;
}
}
finally {
Disposer.dispose(rootDisposable);
else {
throw e;
}
}
return exitCode;
finally {
Disposer.dispose(rootDisposable);
}
}
catch (AnalysisResult.CompilationErrorException e) {
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.CompilerMessageSeverity.INFO
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.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.Services
@@ -44,8 +43,6 @@ abstract class CLITool<A : CommonToolArguments> {
messageRenderer: MessageRenderer,
args: Array<out String>
): ExitCode {
K2JVMCompiler.resetInitStartTime()
val arguments = createArguments()
parseCommandLineArguments(args.asList(), arguments)
val collector = PrintingMessageCollector(errStream, messageRenderer, arguments.verbose)
@@ -345,15 +345,6 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
companion object {
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
fun main(args: Array<String>) {
@@ -368,19 +359,13 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
fun reportGCTime(configuration: CompilerConfiguration) {
ManagementFactory.getGarbageCollectorMXBeans().forEach {
val currentTime = it.collectionTime
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
reportPerf(configuration, "GC time for ${it.name} is ${it.collectionTime} ms")
}
}
fun reportCompilationTime(configuration: CompilerConfiguration) {
val bean = ManagementFactory.getCompilationMXBean() ?: return
val currentTime = bean.totalCompilationTime
reportPerf(configuration, "JIT time is ${currentTime - elapsedJITTime} ms")
elapsedJITTime = currentTime
reportPerf(configuration, "JIT time is ${bean.totalCompilationTime} ms")
}
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
-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
-Xrepeat=<count> Repeat compilation (for performance analysis)
-Xreport-output-files Report source to output files mapping
-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
-1
View File
@@ -59,7 +59,6 @@ where advanced options include:
-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
-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
-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