Remove forced dependency of new MM on mimalloc (#4617)

This commit is contained in:
Alexander Shabalin
2020-12-24 15:25:59 +03:00
committed by Nikolay Krasko
parent e753ce048e
commit 39805c72dc
2 changed files with 26 additions and 13 deletions
@@ -124,11 +124,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
MemoryModel.STRICT -> MemoryModel.STRICT MemoryModel.STRICT -> MemoryModel.STRICT
MemoryModel.RELAXED -> MemoryModel.RELAXED MemoryModel.RELAXED -> MemoryModel.RELAXED
MemoryModel.EXPERIMENTAL -> { MemoryModel.EXPERIMENTAL -> {
if (!target.supportsMimallocAllocator()) { if (!target.supportsThreads()) {
configuration.report(CompilerMessageSeverity.STRONG_WARNING,
"Experimental memory model requires mimalloc allocator. Used strict memory model.")
MemoryModel.STRICT
} else if (!target.supportsThreads()) {
configuration.report(CompilerMessageSeverity.STRONG_WARNING, configuration.report(CompilerMessageSeverity.STRONG_WARNING,
"Experimental memory model requires threads, which are not supported on target ${target.name}. Used strict memory model.") "Experimental memory model requires threads, which are not supported on target ${target.name}. Used strict memory model.")
MemoryModel.STRICT MemoryModel.STRICT
@@ -141,9 +137,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
} }
} }
} }
val useMimalloc = if (effectiveMemoryModel == MemoryModel.EXPERIMENTAL) { val useMimalloc = if (configuration.get(KonanConfigKeys.ALLOCATION_MODE) == "mimalloc") {
true // we already checked that target supports mimalloc.
} else if (configuration.get(KonanConfigKeys.ALLOCATION_MODE) == "mimalloc") {
if (target.supportsMimallocAllocator()) { if (target.supportsMimallocAllocator()) {
true true
} else { } else {
+24 -5
View File
@@ -140,8 +140,8 @@ targetList.forEach { targetName ->
createTestTask( createTestTask(
project, project,
"ExperimentalMM", "ExperimentalMMMimalloc",
"${targetName}ExperimentalMMRuntimeTests", "${targetName}ExperimentalMMMimallocRuntimeTests",
listOf( listOf(
"${targetName}Runtime", "${targetName}Runtime",
"${targetName}ExperimentalMemoryManager", "${targetName}ExperimentalMemoryManager",
@@ -153,10 +153,25 @@ targetList.forEach { targetName ->
includeRuntime() includeRuntime()
} }
createTestTask(
project,
"ExperimentalMMStdAlloc",
"${targetName}ExperimentalMMStdAllocRuntimeTests",
listOf(
"${targetName}Runtime",
"${targetName}ExperimentalMemoryManager",
"${targetName}Release",
"${targetName}StdAlloc"
)
) {
includeRuntime()
}
tasks.register("${targetName}RuntimeTests") { tasks.register("${targetName}RuntimeTests") {
dependsOn("${targetName}StdAllocRuntimeTests") dependsOn("${targetName}StdAllocRuntimeTests")
dependsOn("${targetName}MimallocRuntimeTests") dependsOn("${targetName}MimallocRuntimeTests")
dependsOn("${targetName}ExperimentalMMRuntimeTests") dependsOn("${targetName}ExperimentalMMStdAllocRuntimeTests")
dependsOn("${targetName}ExperimentalMMMimallocRuntimeTests")
} }
} }
@@ -176,8 +191,12 @@ val hostMimallocRuntimeTests by tasks.registering {
dependsOn("${hostName}MimallocRuntimeTests") dependsOn("${hostName}MimallocRuntimeTests")
} }
val hostExperimentalMMRuntimeTests by tasks.registering { val hostExperimentalMMStdAllocRuntimeTests by tasks.registering {
dependsOn("${hostName}ExperimentalMMRuntimeTests") dependsOn("${hostName}ExperimentalMMStdAllocRuntimeTests")
}
val hostExperimentalMMMimallocRuntimeTests by tasks.registering {
dependsOn("${hostName}ExperimentalMMMimallocRuntimeTests")
} }
val assemble by tasks.registering { val assemble by tasks.registering {