[K/N] Logging for runtime
This commit is contained in:
committed by
Space
parent
516c2933ce
commit
a279b2230f
@@ -359,6 +359,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
}
|
||||
}
|
||||
})
|
||||
putIfNotNull(RUNTIME_LOGS, arguments.runtimeLogs)
|
||||
|
||||
parseBinaryOptions(arguments, configuration).forEach { optionWithValue ->
|
||||
configuration.put(optionWithValue)
|
||||
|
||||
+3
@@ -348,6 +348,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
||||
)
|
||||
var binaryOptions: Array<String>? = null
|
||||
|
||||
@Argument(value = "-Xruntime-logs", valueDescription = "<tag1=level1,tag2=level2,...>", description = "Enable logging for runtime with tags.")
|
||||
var runtimeLogs: String? = null
|
||||
|
||||
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> =
|
||||
super.configureAnalysisFlags(collector, languageVersion).also {
|
||||
val useExperimental = it[AnalysisFlags.useExperimental] as List<*>
|
||||
|
||||
+1
@@ -62,6 +62,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
val gcAggressive: Boolean get() = configuration.get(KonanConfigKeys.GARBAGE_COLLECTOR_AGRESSIVE)!!
|
||||
val runtimeAssertsMode: RuntimeAssertsMode get() = configuration.get(BinaryOptions.runtimeAssertionsMode) ?: RuntimeAssertsMode.IGNORE
|
||||
val workerExceptionHandling: WorkerExceptionHandling get() = configuration.get(KonanConfigKeys.WORKER_EXCEPTION_HANDLING)!!
|
||||
val runtimeLogs: String? get() = configuration.get(KonanConfigKeys.RUNTIME_LOGS)
|
||||
|
||||
val needVerifyIr: Boolean
|
||||
get() = configuration.get(KonanConfigKeys.VERIFY_IR) == true
|
||||
|
||||
+1
@@ -165,6 +165,7 @@ class KonanConfigKeys {
|
||||
val EXTERNAL_DEPENDENCIES: CompilerConfigurationKey<String?> =
|
||||
CompilerConfigurationKey.create("use external dependencies to enhance IR linker error messages")
|
||||
val LLVM_VARIANT: CompilerConfigurationKey<LlvmVariant?> = CompilerConfigurationKey.create("llvm variant")
|
||||
val RUNTIME_LOGS: CompilerConfigurationKey<String> = CompilerConfigurationKey.create("enable runtime logging")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -2590,6 +2590,10 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
|
||||
setRuntimeConstGlobal("KonanNeedDebugInfo", Int32(if (context.shouldContainDebugInfo()) 1 else 0))
|
||||
setRuntimeConstGlobal("Kotlin_runtimeAssertsMode", Int32(context.config.runtimeAssertsMode.value))
|
||||
val runtimeLogs = context.config.runtimeLogs?.let {
|
||||
context.llvm.staticData.cStringLiteral(it)
|
||||
} ?: NullPointer(int8Type)
|
||||
setRuntimeConstGlobal("Kotlin_runtimeLogs", runtimeLogs)
|
||||
}
|
||||
|
||||
// Globals set this way cannot be const, but are overridable when producing final executable.
|
||||
|
||||
Reference in New Issue
Block a user