[K/N] Add flag to disable allocator overhead estimate

This commit is contained in:
Troels Bjerre Lund
2023-10-02 14:54:41 +02:00
committed by Space Cloud
parent 3ae7b790a9
commit 239f3a30cb
6 changed files with 13 additions and 0 deletions
@@ -64,6 +64,8 @@ object BinaryOptions : BinaryOptionRegistry() {
val objcDisposeOnMain by booleanOption()
val disableMmap by booleanOption()
val disableAllocatorOverheadEstimate by booleanOption()
}
open class BinaryOption<T : Any>(
@@ -110,6 +110,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
}
}
}
val disableAllocatorOverheadEstimate: Boolean by lazy {
configuration.get(BinaryOptions.disableAllocatorOverheadEstimate) ?: false
}
val workerExceptionHandling: WorkerExceptionHandling get() = configuration.get(KonanConfigKeys.WORKER_EXCEPTION_HANDLING)?.also {
if (it != WorkerExceptionHandling.USE_HOOK) {
configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Legacy exception handling in workers is deprecated")
@@ -2987,6 +2987,7 @@ internal fun NativeGenerationState.generateRuntimeConstantsModule() : LLVMModule
setRuntimeConstGlobal("Kotlin_needDebugInfo", llvm.constInt32(if (shouldContainDebugInfo()) 1 else 0))
setRuntimeConstGlobal("Kotlin_runtimeAssertsMode", llvm.constInt32(config.runtimeAssertsMode.value))
setRuntimeConstGlobal("Kotlin_disableMmap", llvm.constInt32(if (config.disableMmap) 1 else 0))
setRuntimeConstGlobal("Kotlin_disableAllocatorOverheadEstimate", llvm.constInt32(if (config.disableAllocatorOverheadEstimate) 1 else 0))
val runtimeLogs = config.runtimeLogs?.let {
static.cStringLiteral(it)
} ?: NullPointer(llvm.int8Type)