Rework default JVM arguments. (#2633)

This commit is contained in:
Nikolay Igotti
2019-02-07 13:08:49 +03:00
committed by GitHub
parent 0078f20992
commit 2d882d1b6c
6 changed files with 16 additions and 8 deletions
+7 -5
View File
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.konan.target.HostManager
/* /*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file. * that can be found in the LICENSE file.
@@ -208,12 +210,12 @@ task teamcityPublishStdLibSources {
// konan.home, --runtime, -Djava.library.path etc // konan.home, --runtime, -Djava.library.path etc
targetList.each { target -> targetList.each { target ->
def konanJvmArgs = ["-ea", "-Xmx3G", def konanJvmArgs = [*HostManager.regularJvmArgs,
"-Dkonan.home=${rootProject.projectDir}", "-Dkonan.home=${rootProject.projectDir}",
"-Djava.library.path=${project.buildDir}/nativelibs/$hostName", "-Djava.library.path=${project.buildDir}/nativelibs/$hostName",
"-Dfile.encoding=UTF-8"] ]
def defaultArgs = ['-nopack', '-nostdlib', '-nodefaultlibs', '-ea'] def defaultArgs = ['-nopack', '-nostdlib', '-nodefaultlibs']
if (target != "wasm32") defaultArgs += '-g' if (target != "wasm32") defaultArgs += '-g'
def konanArgs = [*defaultArgs, def konanArgs = [*defaultArgs,
'-target', target, '-target', target,
+1
View File
@@ -66,6 +66,7 @@ NATIVE_LIB="${KONAN_HOME}/konan/nativelib"
java_opts=(-ea \ java_opts=(-ea \
-Xmx3G \ -Xmx3G \
-XX:TieredStopAtLevel=1 \
"-Djava.library.path=${NATIVE_LIB}" \ "-Djava.library.path=${NATIVE_LIB}" \
"-Dkonan.home=${KONAN_HOME}" \ "-Dkonan.home=${KONAN_HOME}" \
-Dfile.encoding=UTF-8 \ -Dfile.encoding=UTF-8 \
+1
View File
@@ -73,6 +73,7 @@ set "KONAN_CLASSPATH=%KOTLIN_JAR%;%KOTLIN_STDLIB_JAR%;%KOTLIN_REFLECT_JAR%;%KOTL
set JAVA_OPTS=-ea ^ set JAVA_OPTS=-ea ^
-Xmx3G ^ -Xmx3G ^
-XX:TieredStopAtLevel=1 ^
"-Djava.library.path=%NATIVE_LIB%" ^ "-Djava.library.path=%NATIVE_LIB%" ^
"-Dkonan.home=%_KONAN_HOME%" ^ "-Dkonan.home=%_KONAN_HOME%" ^
-Dfile.encoding=UTF-8 ^ -Dfile.encoding=UTF-8 ^
+2 -2
View File
@@ -1,6 +1,5 @@
import org.jetbrains.kotlin.KlibInstall import org.jetbrains.kotlin.KlibInstall
import org.jetbrains.kotlin.konan.target.* import org.jetbrains.kotlin.konan.target.*
import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.util.* import org.jetbrains.kotlin.konan.util.*
import static org.jetbrains.kotlin.konan.util.VisibleNamedKt.getVisibleName import static org.jetbrains.kotlin.konan.util.VisibleNamedKt.getVisibleName
@@ -22,7 +21,8 @@ buildscript {
} }
ext.konanHome = distDir.absolutePath ext.konanHome = distDir.absolutePath
ext.jvmArgs = project.findProperty("platformLibsJvmArgs") ?: "-Xmx6G" def jvmArguments = [project.findProperty("platformLibsJvmArgs") ?: "-Xmx6G", *HostManager.defaultJvmArgs]
ext.jvmArgs = jvmArguments.join(" ")
ext.setProperty("konan.home", konanHome) ext.setProperty("konan.home", konanHome)
ext.setProperty("konan.jvmArgs", jvmArgs) ext.setProperty("konan.jvmArgs", jvmArgs)
} }
@@ -249,6 +249,10 @@ open class HostManager(protected val distribution: Distribution = Distribution()
else -> throw TargetSupportException("Unknown host target: ${host_os()} ${host_arch()}") else -> throw TargetSupportException("Unknown host target: ${host_os()} ${host_arch()}")
} }
// Note Hotspot-specific VM option enforcing C1-only, critical for decent compilation speed.
val defaultJvmArgs = listOf("-XX:TieredStopAtLevel=1", "-ea", "-Dfile.encoding=UTF-8")
val regularJvmArgs = defaultJvmArgs + "-Xmx3G"
val hostIsMac = (host.family == Family.OSX) val hostIsMac = (host.family == Family.OSX)
val hostIsLinux = (host.family == Family.LINUX) val hostIsLinux = (host.family == Family.LINUX)
val hostIsMingw = (host.family == Family.MINGW) val hostIsMingw = (host.family == Family.MINGW)
@@ -58,7 +58,7 @@ internal abstract class KonanCliRunner(
project.fileTree("${project.konanHome}/konan/lib/") project.fileTree("${project.konanHome}/konan/lib/")
.apply { include("*.jar") } .apply { include("*.jar") }
override val jvmArgs = mutableListOf("-ea").apply { override val jvmArgs = HostManager.defaultJvmArgs.toMutableList().apply {
if (additionalJvmArgs.none { it.startsWith("-Xmx") } && if (additionalJvmArgs.none { it.startsWith("-Xmx") } &&
project.jvmArgs.none { it.startsWith("-Xmx") }) { project.jvmArgs.none { it.startsWith("-Xmx") }) {
add("-Xmx3G") add("-Xmx3G")