From 39805c72dc233bcee736445ba1e1c2e7ff59d10b Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Thu, 24 Dec 2020 15:25:59 +0300 Subject: [PATCH] Remove forced dependency of new MM on mimalloc (#4617) --- .../kotlin/backend/konan/KonanConfig.kt | 10 ++----- kotlin-native/runtime/build.gradle.kts | 29 +++++++++++++++---- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt index 9a6a2755326..f2350f8d43d 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt @@ -124,11 +124,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration MemoryModel.STRICT -> MemoryModel.STRICT MemoryModel.RELAXED -> MemoryModel.RELAXED MemoryModel.EXPERIMENTAL -> { - if (!target.supportsMimallocAllocator()) { - configuration.report(CompilerMessageSeverity.STRONG_WARNING, - "Experimental memory model requires mimalloc allocator. Used strict memory model.") - MemoryModel.STRICT - } else if (!target.supportsThreads()) { + if (!target.supportsThreads()) { configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Experimental memory model requires threads, which are not supported on target ${target.name}. Used strict memory model.") MemoryModel.STRICT @@ -141,9 +137,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration } } } - val useMimalloc = if (effectiveMemoryModel == MemoryModel.EXPERIMENTAL) { - true // we already checked that target supports mimalloc. - } else if (configuration.get(KonanConfigKeys.ALLOCATION_MODE) == "mimalloc") { + val useMimalloc = if (configuration.get(KonanConfigKeys.ALLOCATION_MODE) == "mimalloc") { if (target.supportsMimallocAllocator()) { true } else { diff --git a/kotlin-native/runtime/build.gradle.kts b/kotlin-native/runtime/build.gradle.kts index 3cbd1d847b7..1d7ffe5b032 100644 --- a/kotlin-native/runtime/build.gradle.kts +++ b/kotlin-native/runtime/build.gradle.kts @@ -140,8 +140,8 @@ targetList.forEach { targetName -> createTestTask( project, - "ExperimentalMM", - "${targetName}ExperimentalMMRuntimeTests", + "ExperimentalMMMimalloc", + "${targetName}ExperimentalMMMimallocRuntimeTests", listOf( "${targetName}Runtime", "${targetName}ExperimentalMemoryManager", @@ -153,10 +153,25 @@ targetList.forEach { targetName -> includeRuntime() } + createTestTask( + project, + "ExperimentalMMStdAlloc", + "${targetName}ExperimentalMMStdAllocRuntimeTests", + listOf( + "${targetName}Runtime", + "${targetName}ExperimentalMemoryManager", + "${targetName}Release", + "${targetName}StdAlloc" + ) + ) { + includeRuntime() + } + tasks.register("${targetName}RuntimeTests") { dependsOn("${targetName}StdAllocRuntimeTests") dependsOn("${targetName}MimallocRuntimeTests") - dependsOn("${targetName}ExperimentalMMRuntimeTests") + dependsOn("${targetName}ExperimentalMMStdAllocRuntimeTests") + dependsOn("${targetName}ExperimentalMMMimallocRuntimeTests") } } @@ -176,8 +191,12 @@ val hostMimallocRuntimeTests by tasks.registering { dependsOn("${hostName}MimallocRuntimeTests") } -val hostExperimentalMMRuntimeTests by tasks.registering { - dependsOn("${hostName}ExperimentalMMRuntimeTests") +val hostExperimentalMMStdAllocRuntimeTests by tasks.registering { + dependsOn("${hostName}ExperimentalMMStdAllocRuntimeTests") +} + +val hostExperimentalMMMimallocRuntimeTests by tasks.registering { + dependsOn("${hostName}ExperimentalMMMimallocRuntimeTests") } val assemble by tasks.registering {