Rework default JVM arguments. (#2633)
This commit is contained in:
@@ -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
|
||||
* that can be found in the LICENSE file.
|
||||
@@ -208,12 +210,12 @@ task teamcityPublishStdLibSources {
|
||||
// konan.home, --runtime, -Djava.library.path etc
|
||||
|
||||
targetList.each { target ->
|
||||
def konanJvmArgs = ["-ea", "-Xmx3G",
|
||||
"-Dkonan.home=${rootProject.projectDir}",
|
||||
"-Djava.library.path=${project.buildDir}/nativelibs/$hostName",
|
||||
"-Dfile.encoding=UTF-8"]
|
||||
def konanJvmArgs = [*HostManager.regularJvmArgs,
|
||||
"-Dkonan.home=${rootProject.projectDir}",
|
||||
"-Djava.library.path=${project.buildDir}/nativelibs/$hostName",
|
||||
]
|
||||
|
||||
def defaultArgs = ['-nopack', '-nostdlib', '-nodefaultlibs', '-ea']
|
||||
def defaultArgs = ['-nopack', '-nostdlib', '-nodefaultlibs']
|
||||
if (target != "wasm32") defaultArgs += '-g'
|
||||
def konanArgs = [*defaultArgs,
|
||||
'-target', target,
|
||||
|
||||
@@ -66,6 +66,7 @@ NATIVE_LIB="${KONAN_HOME}/konan/nativelib"
|
||||
|
||||
java_opts=(-ea \
|
||||
-Xmx3G \
|
||||
-XX:TieredStopAtLevel=1 \
|
||||
"-Djava.library.path=${NATIVE_LIB}" \
|
||||
"-Dkonan.home=${KONAN_HOME}" \
|
||||
-Dfile.encoding=UTF-8 \
|
||||
|
||||
@@ -73,6 +73,7 @@ set "KONAN_CLASSPATH=%KOTLIN_JAR%;%KOTLIN_STDLIB_JAR%;%KOTLIN_REFLECT_JAR%;%KOTL
|
||||
|
||||
set JAVA_OPTS=-ea ^
|
||||
-Xmx3G ^
|
||||
-XX:TieredStopAtLevel=1 ^
|
||||
"-Djava.library.path=%NATIVE_LIB%" ^
|
||||
"-Dkonan.home=%_KONAN_HOME%" ^
|
||||
-Dfile.encoding=UTF-8 ^
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import org.jetbrains.kotlin.KlibInstall
|
||||
import org.jetbrains.kotlin.konan.target.*
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.konan.util.*
|
||||
|
||||
import static org.jetbrains.kotlin.konan.util.VisibleNamedKt.getVisibleName
|
||||
@@ -22,7 +21,8 @@ buildscript {
|
||||
}
|
||||
|
||||
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.jvmArgs", jvmArgs)
|
||||
}
|
||||
|
||||
@@ -249,6 +249,10 @@ open class HostManager(protected val distribution: Distribution = Distribution()
|
||||
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 hostIsLinux = (host.family == Family.LINUX)
|
||||
val hostIsMingw = (host.family == Family.MINGW)
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ internal abstract class KonanCliRunner(
|
||||
project.fileTree("${project.konanHome}/konan/lib/")
|
||||
.apply { include("*.jar") }
|
||||
|
||||
override val jvmArgs = mutableListOf("-ea").apply {
|
||||
override val jvmArgs = HostManager.defaultJvmArgs.toMutableList().apply {
|
||||
if (additionalJvmArgs.none { it.startsWith("-Xmx") } &&
|
||||
project.jvmArgs.none { it.startsWith("-Xmx") }) {
|
||||
add("-Xmx3G")
|
||||
|
||||
Reference in New Issue
Block a user