[K/N] Deprecate and remove from supported list relaxed memory model

This commit is contained in:
Elena Lepilkina
2021-10-28 15:39:23 +03:00
committed by Space
parent f67941e244
commit 1b4ee63f30
4 changed files with 9 additions and 11 deletions
@@ -233,10 +233,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
put(ENABLE_ASSERTIONS, arguments.enableAssertions)
val memoryModelFromArgument = when (arguments.memoryModel) {
"relaxed" -> {
configuration.report(STRONG_WARNING, "Relaxed memory model is not yet fully functional")
MemoryModel.RELAXED
}
"relaxed" -> MemoryModel.RELAXED
"strict" -> MemoryModel.STRICT
"experimental" -> MemoryModel.EXPERIMENTAL
else -> {
@@ -47,7 +47,7 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-manifest", valueDescription = "<path>", description = "Provide a maniferst addend file")
var manifestFile: String? = null
@Argument(value="-memory-model", valueDescription = "<model>", description = "Memory model to use, 'strict', 'relaxed' and 'experimental' are currently supported")
@Argument(value="-memory-model", valueDescription = "<model>", description = "Memory model to use, 'strict' and 'experimental' are currently supported")
var memoryModel: String? = "strict"
@Argument(value="-module-name", deprecatedName = "-module_name", valueDescription = "<name>", description = "Specify a name for the compilation module")
@@ -59,7 +59,12 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
val memoryModel: MemoryModel by lazy {
when (configuration.get(BinaryOptions.memoryModel)!!) {
MemoryModel.STRICT -> MemoryModel.STRICT
MemoryModel.RELAXED -> MemoryModel.RELAXED
MemoryModel.RELAXED -> {
configuration.report(CompilerMessageSeverity.ERROR,
"Relaxed memory model is deprecated and isn't expected to work right way with current Kotlin version." +
" Use strict as default. ")
MemoryModel.STRICT
}
MemoryModel.EXPERIMENTAL -> {
if (!target.supportsThreads()) {
configuration.report(CompilerMessageSeverity.STRONG_WARNING,
@@ -314,11 +314,7 @@ open class KonanLocalTest : KonanTest() {
// TODO: as for now it captures output only in the driver task.
// It should capture output from the build task using Gradle's LoggerManager and LoggerOutput
val compilationLog = project.file("$executable.compilation.log").readText()
// TODO: ugly hack to fix irrelevant warnings.
val filteredCompilationLog = compilationLog.split('\n').filter {
it != "warning: relaxed memory model is not yet fully functional"
}.joinToString(separator = "\n")
output.stdOut = filteredCompilationLog + output.stdOut
output.stdOut = compilationLog + output.stdOut
}
output.check()
output.print()