Put GC implementations into separate modules.
The mm module now compiles separately for each GC implementation.
This commit is contained in:
committed by
Space
parent
41ab97ff1f
commit
5e456ed82b
@@ -206,7 +206,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
|
||||
put(ENABLE_ASSERTIONS, arguments.enableAssertions)
|
||||
|
||||
put(MEMORY_MODEL, when (arguments.memoryModel) {
|
||||
val memoryModel = when (arguments.memoryModel) {
|
||||
"relaxed" -> {
|
||||
configuration.report(STRONG_WARNING, "Relaxed memory model is not yet fully functional")
|
||||
MemoryModel.RELAXED
|
||||
@@ -217,7 +217,9 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
configuration.report(ERROR, "Unsupported memory model ${arguments.memoryModel}")
|
||||
MemoryModel.STRICT
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
put(MEMORY_MODEL, memoryModel)
|
||||
|
||||
when {
|
||||
arguments.generateWorkerTestRunner -> put(GENERATE_TEST_RUNNER, TestRunnerKind.WORKER)
|
||||
@@ -271,6 +273,26 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
DestroyRuntimeMode.ON_SHUTDOWN
|
||||
}
|
||||
})
|
||||
val assertGcSupported = {
|
||||
if (memoryModel != MemoryModel.EXPERIMENTAL) {
|
||||
configuration.report(ERROR, "-Xgc is only supported for -memory-model experimental")
|
||||
}
|
||||
}
|
||||
put(GARBAGE_COLLECTOR, when (arguments.gc) {
|
||||
null -> GC.SINGLE_THREAD_MARK_SWEEP
|
||||
"noop" -> {
|
||||
assertGcSupported()
|
||||
GC.NOOP
|
||||
}
|
||||
"stms" -> {
|
||||
assertGcSupported()
|
||||
GC.SINGLE_THREAD_MARK_SWEEP
|
||||
}
|
||||
else -> {
|
||||
configuration.report(ERROR, "Unsupported GC ${arguments.gc}")
|
||||
GC.SINGLE_THREAD_MARK_SWEEP
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -305,6 +305,9 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(value="-Xdestroy-runtime-mode", valueDescription = "<mode>", description = "When to destroy runtime. 'legacy' and 'on-shutdown' are currently supported. NOTE: 'legacy' mode is deprecated and will be removed.")
|
||||
var destroyRuntimeMode: String? = "on-shutdown"
|
||||
|
||||
@Argument(value="-Xgc", valueDescription = "<gc>", description = "GC to use, 'noop' and 'stms' are currently supported. Works only with -memory-model experimental")
|
||||
var gc: String? = null
|
||||
|
||||
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> =
|
||||
super.configureAnalysisFlags(collector).also {
|
||||
val useExperimental = it[AnalysisFlags.useExperimental] as List<*>
|
||||
|
||||
Reference in New Issue
Block a user