Add runtime string concat options. Some renaming
This commit is contained in:
+10
@@ -334,6 +334,16 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
)
|
||||
var emitJvmTypeAnnotations: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xruntime-string-concat",
|
||||
valueDescription = "{disable|enable|indy}",
|
||||
description = """Switch a way in which string concatenation is performed.
|
||||
-Xruntime-string-concat=enable Performs string concatenation via `invokedynamic` 'makeConcatWithConstants'. Works only with `-jvm-target 9` or greater
|
||||
-Xruntime-string-concat=indy Performs string concatenation via `invokedynamic` 'makeConcat'. Works only with `-jvm-target 9` or greater
|
||||
-Xruntime-string-concat=disable Performs string concatenation via `StringBuilder`"""
|
||||
)
|
||||
var runtimeStringConcat: String? by NullableStringFreezableVar(JvmRuntimeStringConcat.DISABLE.name.toLowerCase())
|
||||
|
||||
@Argument(
|
||||
value = "-Xklib",
|
||||
valueDescription = "<path>",
|
||||
|
||||
@@ -49,6 +49,24 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.runtimeStringConcat != null) {
|
||||
val runtimeStringConcat = JvmRuntimeStringConcat.fromString(arguments.runtimeStringConcat!!)
|
||||
if (runtimeStringConcat != null) {
|
||||
put(JVMConfigurationKeys.RUNTIME_STRING_CONCAT, runtimeStringConcat)
|
||||
if (jvmTarget.bytecodeVersion < JvmTarget.JVM_9.bytecodeVersion && runtimeStringConcat != JvmRuntimeStringConcat.DISABLE) {
|
||||
messageCollector.report(
|
||||
WARNING,
|
||||
"`-Xruntime-string-concat=${arguments.runtimeStringConcat}` does nothing with JVM target `${jvmTarget.description}`."
|
||||
)
|
||||
}
|
||||
} else {
|
||||
messageCollector.report(
|
||||
ERROR, "Unknown `runtime-string-concat` mode: ${arguments.jvmTarget}\n" +
|
||||
"Supported versions: ${JvmRuntimeStringConcat.values().joinToString { it.name.toLowerCase() }}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user