[K/N] Enable custom allocator by default ^KT-55364

This commit is contained in:
Alexander Shabalin
2023-05-11 17:30:49 +02:00
committed by Space Team
parent 1e09e8663c
commit da1fde2477
7 changed files with 32 additions and 0 deletions
@@ -229,6 +229,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
private val shouldCoverLibraries = !configuration.getList(KonanConfigKeys.LIBRARIES_TO_COVER).isNullOrEmpty()
private val defaultAllocationMode get() = when {
gc == GC.PARALLEL_MARK_CONCURRENT_SWEEP && sanitizer == null -> {
AllocationMode.CUSTOM
}
target.supportsMimallocAllocator() && sanitizer == null -> {
AllocationMode.MIMALLOC
}
@@ -240,6 +243,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
null -> defaultAllocationMode
AllocationMode.STD -> AllocationMode.STD
AllocationMode.MIMALLOC -> {
if (sanitizer != null) {
configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Sanitizers are useful only with the std allocator")
}
if (target.supportsMimallocAllocator()) {
AllocationMode.MIMALLOC
} else {
@@ -249,6 +255,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
}
}
AllocationMode.CUSTOM -> {
if (sanitizer != null) {
configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Sanitizers are useful only with the std allocator")
}
if (gc == GC.PARALLEL_MARK_CONCURRENT_SWEEP) {
AllocationMode.CUSTOM
} else {
@@ -3135,6 +3135,7 @@ standaloneTest("stress_gc_allocations") {
(project.testTarget != "watchos_simulator_arm64") &&
!isNoopGC &&
!isAggressiveGC && // TODO: Investigate why too slow
!runtimeAssertionsPanic && // New allocator with assertions makes this test very slow
(project.testTarget != "mingw_x64") // TODO: Fix on mingw.
source = "runtime/memory/stress_gc_allocations.kt"
flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']