Add a switch to destroy runtime only on shutdown (#4482)

This commit is contained in:
Alexander Shabalin
2020-11-13 09:19:10 +03:00
committed by Stanislav Erokhin
parent 37ff2c338e
commit ee508efb23
18 changed files with 254 additions and 37 deletions
@@ -250,6 +250,14 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
put(DISABLE_FAKE_OVERRIDE_VALIDATOR, arguments.disableFakeOverrideValidator)
putIfNotNull(PRE_LINK_CACHES, parsePreLinkCachesValue(configuration, arguments.preLinkCaches))
putIfNotNull(OVERRIDE_KONAN_PROPERTIES, parseOverrideKonanProperties(arguments, configuration))
put(DESTROY_RUNTIME_MODE, when (arguments.destroyRuntimeMode) {
"legacy" -> DestroyRuntimeMode.LEGACY
"on-shutdown" -> DestroyRuntimeMode.ON_SHUTDOWN
else -> {
configuration.report(ERROR, "Unsupported destroy runtime mode ${arguments.destroyRuntimeMode}")
DestroyRuntimeMode.ON_SHUTDOWN
}
})
}
}
}
@@ -285,6 +285,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
)
var overrideKonanProperties: Array<String>? = null
@Argument(value="-Xdestroy-runtime-mode", valueDescription = "<mode>", description = "When to destroy runtime. 'legacy' and 'on-shutdown' are currently supported. NOTE: 'legacy' mode is deprecated and will be removed.")
var destroyRuntimeMode: String? = "on-shutdown"
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> =
super.configureAnalysisFlags(collector).also {
val useExperimental = it[AnalysisFlags.useExperimental] as List<*>