[K/N] Move GC schedulers into modules

Additionally,
- rename disabled into manual
- rename with_timer into adaptive
- remove on_safepoints
- store schedulers in GlobalData, ThreadData directly
This commit is contained in:
Alexander Shabalin
2023-03-01 10:19:40 +01:00
committed by Space Team
parent 0ad98ff610
commit 63e65a482c
47 changed files with 1350 additions and 1414 deletions
@@ -6,12 +6,12 @@
package org.jetbrains.kotlin.backend.konan
// Must match `GCSchedulerType` in CompilerConstants.hpp
enum class GCSchedulerType(val value: Int, val deprecatedWithReplacement: GCSchedulerType? = null) {
MANUAL(0),
ADAPTIVE(1),
AGGRESSIVE(3),
enum class GCSchedulerType(val deprecatedWithReplacement: GCSchedulerType? = null) {
MANUAL,
ADAPTIVE,
AGGRESSIVE,
// Deprecated:
DISABLED(0, deprecatedWithReplacement = MANUAL),
WITH_TIMER(1, deprecatedWithReplacement = ADAPTIVE),
ON_SAFE_POINTS(2, deprecatedWithReplacement = ADAPTIVE),
DISABLED(deprecatedWithReplacement = MANUAL),
WITH_TIMER(deprecatedWithReplacement = ADAPTIVE),
ON_SAFE_POINTS(deprecatedWithReplacement = ADAPTIVE),
}
@@ -272,6 +272,21 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
internal val runtimeNativeLibraries: List<String> = mutableListOf<String>().apply {
if (debug) add("debug.bc")
add("common_gc.bc")
add("common_gcScheduler.bc")
when (gcSchedulerType) {
GCSchedulerType.MANUAL -> {
add("manual_gcScheduler.bc")
}
GCSchedulerType.ADAPTIVE -> {
add("adaptive_gcScheduler.bc")
}
GCSchedulerType.AGGRESSIVE -> {
add("aggressive_gcScheduler.bc")
}
GCSchedulerType.DISABLED, GCSchedulerType.WITH_TIMER, GCSchedulerType.ON_SAFE_POINTS -> {
throw IllegalStateException("Deprecated options must have already been handled")
}
}
if (allocationMode == AllocationMode.CUSTOM) {
add("experimental_memory_manager_custom.bc")
add("concurrent_ms_gc_custom.bc")
@@ -3000,7 +3000,6 @@ internal fun NativeGenerationState.generateRuntimeConstantsModule() : LLVMModule
setRuntimeConstGlobal("Kotlin_runtimeLogs", runtimeLogs)
setRuntimeConstGlobal("Kotlin_freezingEnabled", llvm.constInt32(if (config.freezing.enableFreezeAtRuntime) 1 else 0))
setRuntimeConstGlobal("Kotlin_freezingChecksEnabled", llvm.constInt32(if (config.freezing.enableFreezeChecks) 1 else 0))
setRuntimeConstGlobal("Kotlin_gcSchedulerType", llvm.constInt32(config.gcSchedulerType.value))
return llvmModule
}