[K/N] Implement non-blocking approach for sweep

This commit is contained in:
Pavel Kunyavskiy
2021-11-23 19:05:06 +03:00
committed by Space
parent df4b367296
commit ebca4d793f
17 changed files with 650 additions and 167 deletions
+3 -3
View File
@@ -111,7 +111,7 @@ extern "C" void DeinitMemory(MemoryState* state, bool destroyRuntime) {
auto* node = mm::FromMemoryState(state);
if (destroyRuntime) {
ThreadStateGuard guard(state, ThreadState::kRunnable);
node->Get()->gc().PerformFullGC();
node->Get()->gc().ScheduleAndWaitFullGC();
// TODO: Also make sure that finalizers are run.
}
mm::ThreadRegistry::Instance().Unregister(node);
@@ -293,7 +293,7 @@ extern "C" RUNTIME_NOTHROW void GC_CollectorCallback(void* worker) {
extern "C" void Kotlin_native_internal_GC_collect(ObjHeader*) {
auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData();
threadData->gc().PerformFullGC();
threadData->gc().ScheduleAndWaitFullGC();
}
extern "C" void Kotlin_native_internal_GC_collectCyclic(ObjHeader*) {
@@ -402,7 +402,7 @@ extern "C" void Kotlin_Any_share(ObjHeader* thiz) {
}
extern "C" RUNTIME_NOTHROW void PerformFullGC(MemoryState* memory) {
memory->GetThreadData()->gc().PerformFullGC();
memory->GetThreadData()->gc().ScheduleAndWaitFullGC();
}
extern "C" bool TryAddHeapRef(const ObjHeader* object) {