IR: an option to automatically select the number of lowering threads
This commit is contained in:
+4
-3
@@ -115,11 +115,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
var doNotClearBindingContext: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-threads-for-file-lowerings",
|
||||
value = "-Xparallel-backend-threads",
|
||||
description = "When using the IR backend, run lowerings by file in N parallel threads.\n" +
|
||||
"Default value is 1"
|
||||
"0 means use a thread per processor core.\n" +
|
||||
"Default value is 1"
|
||||
)
|
||||
var threadsForFileLowerings: String by FreezableVar("1")
|
||||
var parallelBackendThreads: String by FreezableVar("1")
|
||||
|
||||
@Argument(value = "-Xmodule-path", valueDescription = "<path>", description = "Paths where to find Java 9+ modules")
|
||||
var javaModulePath: String? by NullableStringFreezableVar(null)
|
||||
|
||||
@@ -292,7 +292,9 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
|
||||
arguments.declarationsOutputPath?.let { put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, it) }
|
||||
|
||||
put(CommonConfigurationKeys.THREADS_FOR_FILE_LOWERINGS, arguments.threadsForFileLowerings.toIntOrNull() ?: 1)
|
||||
val nThreadsRaw = arguments.parallelBackendThreads.toIntOrNull() ?: 1
|
||||
val nThreads = if (nThreadsRaw == 0) Runtime.getRuntime().availableProcessors() else nThreadsRaw
|
||||
put(CommonConfigurationKeys.PARALLEL_BACKEND_THREADS, nThreads)
|
||||
}
|
||||
|
||||
fun CompilerConfiguration.configureKlibPaths(arguments: K2JVMCompilerArguments) {
|
||||
|
||||
Reference in New Issue
Block a user