[K/N] Parallelize marking in CMS GC
This change parallelizes marking by making each non-native Kotlin thread mark its own view of the heap. To make this safe, we make flipping the marking bit atomic which ensures that threads do not try to trace the same objects. Co-authored-by: Johan Bay <jobay@google.com> Merge-request: KOTLIN-MR-423 Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
This commit is contained in:
+2
@@ -31,6 +31,8 @@ object BinaryOptions : BinaryOptionRegistry() {
|
||||
|
||||
val gcSchedulerType by option<GCSchedulerType>()
|
||||
|
||||
val gcMarkSingleThreaded by booleanOption()
|
||||
|
||||
val linkRuntime by option<RuntimeLinkageStrategyBinaryOption>()
|
||||
|
||||
val bundleId by stringOption()
|
||||
|
||||
+3
@@ -170,6 +170,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
configuration.get(BinaryOptions.gcSchedulerType) ?: defaultGCSchedulerType
|
||||
}
|
||||
|
||||
val gcMarkSingleThreaded: Boolean
|
||||
get() = configuration.get(BinaryOptions.gcMarkSingleThreaded) == true
|
||||
|
||||
val needVerifyIr: Boolean
|
||||
get() = configuration.get(KonanConfigKeys.VERIFY_IR) == true
|
||||
|
||||
|
||||
+1
@@ -2773,6 +2773,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
return
|
||||
|
||||
overrideRuntimeGlobal("Kotlin_destroyRuntimeMode", Int32(context.config.destroyRuntimeMode.value))
|
||||
overrideRuntimeGlobal("Kotlin_gcMarkSingleThreaded", Int32(if (context.config.gcMarkSingleThreaded) 1 else 0))
|
||||
overrideRuntimeGlobal("Kotlin_workerExceptionHandling", Int32(context.config.workerExceptionHandling.value))
|
||||
overrideRuntimeGlobal("Kotlin_suspendFunctionsFromAnyThreadFromObjC", Int32(if (context.config.suspendFunctionsFromAnyThreadFromObjC) 1 else 0))
|
||||
val getSourceInfoFunctionName = when (context.config.sourceInfoType) {
|
||||
|
||||
Reference in New Issue
Block a user