[K/N] Concurrent phase in GC mark (KT-58865)

+ Log Stop The World reasons

Merge-request: KT-MR-13759
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
This commit is contained in:
Aleksei.Glushko
2024-01-09 18:34:36 +00:00
committed by Space Team
parent f8fd46a5b8
commit 8ed806ebe0
35 changed files with 539 additions and 599 deletions
@@ -186,7 +186,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
} ?: arg
}
private val defaultGcMarkSingleThreaded get() = target.family == Family.MINGW
private val defaultGcMarkSingleThreaded get() = target.family == Family.MINGW && gc == GC.PARALLEL_MARK_CONCURRENT_SWEEP
val gcMarkSingleThreaded: Boolean by lazy {
configuration.get(BinaryOptions.gcMarkSingleThreaded) ?: defaultGcMarkSingleThreaded
@@ -203,6 +203,12 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
"Mutators cooperation is not supported during single threaded mark")
}
false
} else if (gc == GC.CONCURRENT_MARK_AND_SWEEP) {
if (mutatorsCooperate == true) {
configuration.report(CompilerMessageSeverity.STRONG_WARNING,
"Mutators cooperation is not yet supported in CMS GC")
}
false
} else {
mutatorsCooperate ?: true
}
@@ -30,6 +30,7 @@ enum class LoggingTag(val ord: Int) {
Alloc(6),
Balancing(7),
Barriers(8),
GCMark(9),
;
companion object {
@@ -481,7 +481,6 @@ internal class CodegenLlvmHelpers(private val generationState: NativeGenerationS
val Kotlin_processObjectInMark by lazyRtFunction
val Kotlin_processArrayInMark by lazyRtFunction
val Kotlin_processFieldInMark by lazyRtFunction
val Kotlin_processEmptyObjectInMark by lazyRtFunction
val UpdateVolatileHeapRef by lazyRtFunction
@@ -1828,6 +1828,10 @@ internal object EscapeAnalysis {
IntraproceduralAnalysis(context, moduleDFG, externalModulesDFG, callGraph).analyze()
InterproceduralAnalysis(context, generationState, callGraph, intraproceduralAnalysisResult, externalModulesDFG, lifetimes,
propagateExiledToHeapObjects = context.config.memoryModel != MemoryModel.EXPERIMENTAL
// The GC must be careful not to scan exiled objects, that have already became dead,
// as they may reference other already destroyed stack-allocated objects.
// TODO somehow tag these object, so that GC could handle them properly.
|| context.config.gc == GC.CONCURRENT_MARK_AND_SWEEP
).analyze()
} catch (t: Throwable) {
val extraUserInfo =