[K/N] Add flag to disable allocator overhead estimate
This commit is contained in:
committed by
Space Cloud
parent
3ae7b790a9
commit
239f3a30cb
+2
@@ -64,6 +64,8 @@ object BinaryOptions : BinaryOptionRegistry() {
|
||||
val objcDisposeOnMain by booleanOption()
|
||||
|
||||
val disableMmap by booleanOption()
|
||||
|
||||
val disableAllocatorOverheadEstimate by booleanOption()
|
||||
}
|
||||
|
||||
open class BinaryOption<T : Any>(
|
||||
|
||||
+3
@@ -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")
|
||||
|
||||
+1
@@ -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)
|
||||
|
||||
@@ -52,6 +52,7 @@ void alloc::Allocator::clearForTests() noexcept {
|
||||
}
|
||||
|
||||
size_t alloc::Allocator::estimateOverheadPerThread() noexcept {
|
||||
if (compiler::disableAllocatorOverheadEstimate()) return 0;
|
||||
return impl_->heap().EstimateOverheadPerThread();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
extern "C" const int32_t Kotlin_needDebugInfo;
|
||||
extern "C" const int32_t Kotlin_runtimeAssertsMode;
|
||||
extern "C" const int32_t Kotlin_disableMmap;
|
||||
extern "C" const int32_t Kotlin_disableAllocatorOverheadEstimate;
|
||||
extern "C" const char* const Kotlin_runtimeLogs;
|
||||
extern "C" const int32_t Kotlin_concurrentWeakSweep;
|
||||
extern "C" const int32_t Kotlin_gcMarkSingleThreaded;
|
||||
@@ -77,6 +78,10 @@ ALWAYS_INLINE inline bool disableMmap() noexcept {
|
||||
return Kotlin_disableMmap != 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE inline bool disableAllocatorOverheadEstimate() noexcept {
|
||||
return Kotlin_disableAllocatorOverheadEstimate != 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE inline std::string_view runtimeLogs() noexcept {
|
||||
return Kotlin_runtimeLogs == nullptr ? std::string_view() : std::string_view(Kotlin_runtimeLogs);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ extern const int32_t Kotlin_disableMmap = 1;
|
||||
#else
|
||||
extern const int32_t Kotlin_disableMmap = 0;
|
||||
#endif
|
||||
extern const int32_t Kotlin_disableAllocatorOverheadEstimate = 0;
|
||||
extern const char* const Kotlin_runtimeLogs = nullptr;
|
||||
extern const int32_t Kotlin_concurrentWeakSweep = 1;
|
||||
#if KONAN_WINDOWS
|
||||
|
||||
Reference in New Issue
Block a user