diff --git a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt b/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt index 8c8cad7a1b7..621fc11563b 100644 --- a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt +++ b/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt @@ -315,6 +315,10 @@ class K2Native : CLICompiler() { assertGcSupported() GC.SAME_THREAD_MARK_AND_SWEEP } + "cms" -> { + assertGcSupported() + GC.CONCURRENT_MARK_AND_SWEEP + } else -> { configuration.report(ERROR, "Unsupported GC ${arguments.gc}") GC.SAME_THREAD_MARK_AND_SWEEP diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/GC.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/GC.kt index 0538683aa10..56158e2517a 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/GC.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/GC.kt @@ -8,4 +8,5 @@ package org.jetbrains.kotlin.backend.konan enum class GC { NOOP, SAME_THREAD_MARK_AND_SWEEP, + CONCURRENT_MARK_AND_SWEEP } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt index 4666fc75e5f..6f413d57dd5 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/KonanConfig.kt @@ -235,6 +235,11 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration add("experimental_memory_manager_noop.bc") add("noop_gc.bc") } + GC.CONCURRENT_MARK_AND_SWEEP -> { + add("common_gc_cms.bc") + add("experimental_memory_manager_cms.bc") + add("concurrent_ms_gc.bc") + } } } } diff --git a/kotlin-native/runtime/build.gradle.kts b/kotlin-native/runtime/build.gradle.kts index 7ac4db3a3b2..52730a895b2 100644 --- a/kotlin-native/runtime/build.gradle.kts +++ b/kotlin-native/runtime/build.gradle.kts @@ -60,9 +60,12 @@ bitcode { "${target}LegacyMemoryManager", "${target}ExperimentalMemoryManagerNoop", "${target}ExperimentalMemoryManagerStms", + "${target}ExperimentalMemoryManagerCms", "${target}CommonGcNoop", "${target}CommonGcStms", + "${target}CommonGcCms", "${target}SameThreadMsGc", + "${target}ConcurrentMsGc", "${target}NoopGc" ) includeRuntime() @@ -182,6 +185,11 @@ bitcode { includeRuntime() } + create("experimental_memory_manager_cms", file("src/mm")) { + headersDirs += files("src/gc/cms/cpp", "src/gc/common/cpp") + includeRuntime() + } + create("common_gc_noop", file("src/gc/common")) { headersDirs += files("src/gc/noop/cpp", "src/mm/cpp") includeRuntime() @@ -192,6 +200,11 @@ bitcode { includeRuntime() } + create("common_gc_cms", file("src/gc/common")) { + headersDirs += files("src/gc/cms/cpp", "src/mm/cpp") + includeRuntime() + } + create("noop_gc", file("src/gc/noop")) { headersDirs += files("src/gc/noop/cpp", "src/gc/common/cpp", "src/mm/cpp") includeRuntime() @@ -201,6 +214,11 @@ bitcode { headersDirs += files("src/gc/stms/cpp", "src/gc/common/cpp", "src/mm/cpp") includeRuntime() } + + create("concurrent_ms_gc", file("src/gc/cms")) { + headersDirs += files("src/gc/cms/cpp", "src/gc/common/cpp", "src/mm/cpp") + includeRuntime() + } } targetList.forEach { targetName -> @@ -272,6 +290,41 @@ targetList.forEach { targetName -> includeRuntime() }) + allTests.addAll(createTestTasks( + project, + targetName, + "${targetName}ExperimentalMMCmsMimallocRuntimeTests", + listOf( + "${targetName}Runtime", + "${targetName}ExperimentalMemoryManagerCms", + "${targetName}CommonGcCms", + "${targetName}ConcurrentMsGc", + "${targetName}Mimalloc", + "${targetName}OptAlloc", + "${targetName}Objc" + ) + ) { + headersDirs += files("src/gc/cms/cpp", "src/gc/common/cpp", "src/mm/cpp") + includeRuntime() + }) + + allTests.addAll(createTestTasks( + project, + targetName, + "${targetName}ExperimentalMMCmsStdAllocRuntimeTests", + listOf( + "${targetName}Runtime", + "${targetName}ExperimentalMemoryManagerCms", + "${targetName}CommonGcCms", + "${targetName}ConcurrentMsGc", + "${targetName}StdAlloc", + "${targetName}Objc" + ) + ) { + headersDirs += files("src/gc/cms/cpp", "src/gc/common/cpp", "src/mm/cpp") + includeRuntime() + }) + allTests.addAll(createTestTasks( project, targetName, diff --git a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp index 5546fad2a49..ba32156f483 100644 --- a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp +++ b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.cpp @@ -3,7 +3,7 @@ * that can be found in the LICENSE file. */ -#include "SameThreadMarkAndSweep.hpp" +#include "ConcurrentMarkAndSweep.hpp" #include @@ -24,55 +24,55 @@ namespace { struct MarkTraits { static bool IsMarked(ObjHeader* object) noexcept { - auto& objectData = mm::ObjectFactory::NodeRef::From(object).GCObjectData(); - return objectData.color() == gc::SameThreadMarkAndSweep::ObjectData::Color::kBlack; + auto& objectData = mm::ObjectFactory::NodeRef::From(object).GCObjectData(); + return objectData.color() == gc::ConcurrentMarkAndSweep::ObjectData::Color::kBlack; } static bool TryMark(ObjHeader* object) noexcept { - auto& objectData = mm::ObjectFactory::NodeRef::From(object).GCObjectData(); - if (objectData.color() == gc::SameThreadMarkAndSweep::ObjectData::Color::kBlack) return false; - objectData.setColor(gc::SameThreadMarkAndSweep::ObjectData::Color::kBlack); + auto& objectData = mm::ObjectFactory::NodeRef::From(object).GCObjectData(); + if (objectData.color() == gc::ConcurrentMarkAndSweep::ObjectData::Color::kBlack) return false; + objectData.setColor(gc::ConcurrentMarkAndSweep::ObjectData::Color::kBlack); return true; }; }; struct SweepTraits { - using ObjectFactory = mm::ObjectFactory; + using ObjectFactory = mm::ObjectFactory; using ExtraObjectsFactory = mm::ExtraObjectDataFactory; static bool IsMarkedByExtraObject(mm::ExtraObjectData &object) noexcept { auto *baseObject = object.GetBaseObject(); if (!baseObject->heap()) return true; - auto& objectData = mm::ObjectFactory::NodeRef::From(baseObject).GCObjectData(); - return objectData.color() == gc::SameThreadMarkAndSweep::ObjectData::Color::kBlack; + auto& objectData = mm::ObjectFactory::NodeRef::From(baseObject).GCObjectData(); + return objectData.color() == gc::ConcurrentMarkAndSweep::ObjectData::Color::kBlack; } static bool TryResetMark(ObjectFactory::NodeRef node) noexcept { auto& objectData = node.GCObjectData(); - if (objectData.color() == gc::SameThreadMarkAndSweep::ObjectData::Color::kWhite) return false; - objectData.setColor(gc::SameThreadMarkAndSweep::ObjectData::Color::kWhite); + if (objectData.color() == gc::ConcurrentMarkAndSweep::ObjectData::Color::kWhite) return false; + objectData.setColor(gc::ConcurrentMarkAndSweep::ObjectData::Color::kWhite); return true; } }; struct FinalizeTraits { - using ObjectFactory = mm::ObjectFactory; + using ObjectFactory = mm::ObjectFactory; }; // Global, because it's accessed on a hot path: avoid memory load from `this`. -std::atomic gSafepointFlag = gc::SameThreadMarkAndSweep::SafepointFlag::kNone; +std::atomic gSafepointFlag = gc::ConcurrentMarkAndSweep::SafepointFlag::kNone; } // namespace -ALWAYS_INLINE void gc::SameThreadMarkAndSweep::ThreadData::SafePointFunctionPrologue() noexcept { +ALWAYS_INLINE void gc::ConcurrentMarkAndSweep::ThreadData::SafePointFunctionPrologue() noexcept { SafePointRegular(GCSchedulerThreadData::kFunctionPrologueWeight); } -ALWAYS_INLINE void gc::SameThreadMarkAndSweep::ThreadData::SafePointLoopBody() noexcept { +ALWAYS_INLINE void gc::ConcurrentMarkAndSweep::ThreadData::SafePointLoopBody() noexcept { SafePointRegular(GCSchedulerThreadData::kLoopBodyWeight); } -void gc::SameThreadMarkAndSweep::ThreadData::SafePointAllocation(size_t size) noexcept { +void gc::ConcurrentMarkAndSweep::ThreadData::SafePointAllocation(size_t size) noexcept { threadData_.gcScheduler().OnSafePointAllocation(size); SafepointFlag flag = gSafepointFlag.load(); if (flag != SafepointFlag::kNone) { @@ -80,7 +80,7 @@ void gc::SameThreadMarkAndSweep::ThreadData::SafePointAllocation(size_t size) no } } -void gc::SameThreadMarkAndSweep::ThreadData::PerformFullGC() noexcept { +void gc::ConcurrentMarkAndSweep::ThreadData::PerformFullGC() noexcept { auto didGC = gc_.PerformFullGC(); if (!didGC) { @@ -89,12 +89,12 @@ void gc::SameThreadMarkAndSweep::ThreadData::PerformFullGC() noexcept { } } -void gc::SameThreadMarkAndSweep::ThreadData::OnOOM(size_t size) noexcept { +void gc::ConcurrentMarkAndSweep::ThreadData::OnOOM(size_t size) noexcept { RuntimeLogDebug({kTagGC}, "Attempt to GC on OOM at size=%zu", size); PerformFullGC(); } -ALWAYS_INLINE void gc::SameThreadMarkAndSweep::ThreadData::SafePointRegular(size_t weight) noexcept { +ALWAYS_INLINE void gc::ConcurrentMarkAndSweep::ThreadData::SafePointRegular(size_t weight) noexcept { threadData_.gcScheduler().OnSafePointRegular(weight); SafepointFlag flag = gSafepointFlag.load(); if (flag != SafepointFlag::kNone) { @@ -102,7 +102,7 @@ ALWAYS_INLINE void gc::SameThreadMarkAndSweep::ThreadData::SafePointRegular(size } } -NO_INLINE void gc::SameThreadMarkAndSweep::ThreadData::SafePointSlowPath(SafepointFlag flag) noexcept { +NO_INLINE void gc::ConcurrentMarkAndSweep::ThreadData::SafePointSlowPath(SafepointFlag flag) noexcept { RuntimeAssert(flag != SafepointFlag::kNone, "Must've been handled by the caller"); // No need to check for kNeedsSuspend, because `suspendIfRequested` checks for its own atomic. threadData_.suspensionData().suspendIfRequested(); @@ -112,14 +112,14 @@ NO_INLINE void gc::SameThreadMarkAndSweep::ThreadData::SafePointSlowPath(Safepoi } } -gc::SameThreadMarkAndSweep::SameThreadMarkAndSweep() noexcept { +gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep() noexcept { mm::GlobalData::Instance().gcScheduler().SetScheduleGC([]() { RuntimeLogDebug({kTagGC}, "Scheduling GC by thread %d", konan::currentThreadId()); gSafepointFlag = SafepointFlag::kNeedsGC; }); } -bool gc::SameThreadMarkAndSweep::PerformFullGC() noexcept { +bool gc::ConcurrentMarkAndSweep::PerformFullGC() noexcept { RuntimeLogDebug({kTagGC}, "Attempt to suspend threads by thread %d", konan::currentThreadId()); auto timeStartUs = konan::getTimeMicros(); bool didSuspend = mm::RequestThreadsSuspension(); @@ -132,7 +132,7 @@ bool gc::SameThreadMarkAndSweep::PerformFullGC() noexcept { RuntimeLogDebug({kTagGC}, "Requested thread suspension by thread %d", konan::currentThreadId()); gSafepointFlag = SafepointFlag::kNeedsSuspend; - mm::ObjectFactory::FinalizerQueue finalizerQueue; + mm::ObjectFactory::FinalizerQueue finalizerQueue; { // Switch state to native to simulate this thread being a GC thread. ThreadStateGuard guard(ThreadState::kNative); diff --git a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.hpp b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.hpp index 5ee1b19edd8..2270fd55232 100644 --- a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.hpp +++ b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweep.hpp @@ -22,7 +22,7 @@ class ThreadData; namespace gc { // Stop-the-world Mark-and-Sweep that runs on mutator threads. Can support targets that do not have threads. -class SameThreadMarkAndSweep : private Pinned { +class ConcurrentMarkAndSweep : private Pinned { public: enum class SafepointFlag { kNone, @@ -47,10 +47,10 @@ public: class ThreadData : private Pinned { public: - using ObjectData = SameThreadMarkAndSweep::ObjectData; + using ObjectData = ConcurrentMarkAndSweep::ObjectData; using Allocator = AllocatorWithGC; - explicit ThreadData(SameThreadMarkAndSweep& gc, mm::ThreadData& threadData) noexcept : gc_(gc), threadData_(threadData) {} + explicit ThreadData(ConcurrentMarkAndSweep& gc, mm::ThreadData& threadData) noexcept : gc_(gc), threadData_(threadData) {} ~ThreadData() = default; void SafePointFunctionPrologue() noexcept; @@ -68,14 +68,14 @@ public: void SafePointRegular(size_t weight) noexcept; void SafePointSlowPath(SafepointFlag flag) noexcept; - SameThreadMarkAndSweep& gc_; + ConcurrentMarkAndSweep& gc_; mm::ThreadData& threadData_; }; using Allocator = ThreadData::Allocator; - SameThreadMarkAndSweep() noexcept; - ~SameThreadMarkAndSweep() = default; + ConcurrentMarkAndSweep() noexcept; + ~ConcurrentMarkAndSweep() = default; private: // Returns `true` if GC has happened, and `false` if not (because someone else has suspended the threads). diff --git a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweepTest.cpp b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweepTest.cpp index 8a2e082bd98..33f3594ca85 100644 --- a/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweepTest.cpp +++ b/kotlin-native/runtime/src/gc/cms/cpp/ConcurrentMarkAndSweepTest.cpp @@ -3,7 +3,7 @@ * that can be found in the LICENSE file. */ -#include "SameThreadMarkAndSweep.hpp" +#include "ConcurrentMarkAndSweep.hpp" #include #include @@ -23,7 +23,7 @@ using namespace kotlin; -// These tests can only work if `GC` is `SameThreadMarkAndSweep`. +// These tests can only work if `GC` is `ConcurrentMarkAndSweep`. // TODO: Extracting GC into a separate module will help with this. namespace { @@ -197,10 +197,10 @@ KStdVector Alive(mm::ThreadData& threadData) { return objects; } -using Color = gc::SameThreadMarkAndSweep::ObjectData::Color; +using Color = gc::ConcurrentMarkAndSweep::ObjectData::Color; Color GetColor(ObjHeader* objHeader) { - auto nodeRef = mm::ObjectFactory::NodeRef::From(objHeader); + auto nodeRef = mm::ObjectFactory::NodeRef::From(objHeader); return nodeRef.GCObjectData().color(); } @@ -214,7 +214,7 @@ WeakCounter& InstallWeakCounter(mm::ThreadData& threadData, ObjHeader* objHeader return weakCounter; } -class SameThreadMarkAndSweepTest : public testing::Test { +class ConcurrentMarkAndSweepTest : public testing::Test { public: ~ConcurrentMarkAndSweepTest() { @@ -231,7 +231,7 @@ private: } // namespace -TEST_F(SameThreadMarkAndSweepTest, RootSet) { +TEST_F(ConcurrentMarkAndSweepTest, RootSet) { RunInNewThread([](mm::ThreadData& threadData) { GlobalObjectHolder global1{threadData}; GlobalObjectArrayHolder global2{threadData}; @@ -266,7 +266,7 @@ TEST_F(SameThreadMarkAndSweepTest, RootSet) { }); } -TEST_F(SameThreadMarkAndSweepTest, InterconnectedRootSet) { +TEST_F(ConcurrentMarkAndSweepTest, InterconnectedRootSet) { RunInNewThread([](mm::ThreadData& threadData) { GlobalObjectHolder global1{threadData}; GlobalObjectArrayHolder global2{threadData}; @@ -312,7 +312,7 @@ TEST_F(SameThreadMarkAndSweepTest, InterconnectedRootSet) { }); } -TEST_F(SameThreadMarkAndSweepTest, FreeObjects) { +TEST_F(ConcurrentMarkAndSweepTest, FreeObjects) { RunInNewThread([](mm::ThreadData& threadData) { auto& object1 = AllocateObject(threadData); auto& object2 = AllocateObject(threadData); @@ -327,7 +327,7 @@ TEST_F(SameThreadMarkAndSweepTest, FreeObjects) { }); } -TEST_F(SameThreadMarkAndSweepTest, FreeObjectsWithFinalizers) { +TEST_F(ConcurrentMarkAndSweepTest, FreeObjectsWithFinalizers) { RunInNewThread([this](mm::ThreadData& threadData) { auto& object1 = AllocateObjectWithFinalizer(threadData); auto& object2 = AllocateObjectWithFinalizer(threadData); @@ -344,7 +344,7 @@ TEST_F(SameThreadMarkAndSweepTest, FreeObjectsWithFinalizers) { }); } -TEST_F(SameThreadMarkAndSweepTest, FreeObjectWithFreeWeak) { +TEST_F(ConcurrentMarkAndSweepTest, FreeObjectWithFreeWeak) { RunInNewThread([](mm::ThreadData& threadData) { auto& object1 = AllocateObject(threadData); auto& weak1 = ([&threadData, &object1]() -> WeakCounter& { @@ -363,7 +363,7 @@ TEST_F(SameThreadMarkAndSweepTest, FreeObjectWithFreeWeak) { }); } -TEST_F(SameThreadMarkAndSweepTest, FreeObjectWithHoldedWeak) { +TEST_F(ConcurrentMarkAndSweepTest, FreeObjectWithHoldedWeak) { RunInNewThread([](mm::ThreadData& threadData) { auto& object1 = AllocateObject(threadData); StackObjectHolder stack{threadData}; @@ -382,7 +382,7 @@ TEST_F(SameThreadMarkAndSweepTest, FreeObjectWithHoldedWeak) { }); } -TEST_F(SameThreadMarkAndSweepTest, ObjectReferencedFromRootSet) { +TEST_F(ConcurrentMarkAndSweepTest, ObjectReferencedFromRootSet) { RunInNewThread([](mm::ThreadData& threadData) { GlobalObjectHolder global{threadData}; StackObjectHolder stack{threadData}; @@ -422,7 +422,7 @@ TEST_F(SameThreadMarkAndSweepTest, ObjectReferencedFromRootSet) { }); } -TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCycles) { +TEST_F(ConcurrentMarkAndSweepTest, ObjectsWithCycles) { RunInNewThread([](mm::ThreadData& threadData) { GlobalObjectHolder global{threadData}; StackObjectHolder stack{threadData}; @@ -471,7 +471,7 @@ TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCycles) { }); } -TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) { +TEST_F(ConcurrentMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) { RunInNewThread([this](mm::ThreadData& threadData) { GlobalObjectHolder global{threadData}; StackObjectHolder stack{threadData}; @@ -522,7 +522,7 @@ TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) { }); } -TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) { +TEST_F(ConcurrentMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) { RunInNewThread([](mm::ThreadData& threadData) { GlobalObjectHolder global{threadData}; StackObjectHolder stack{threadData}; @@ -550,7 +550,7 @@ TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) { }); } -TEST_F(SameThreadMarkAndSweepTest, RunGCTwice) { +TEST_F(ConcurrentMarkAndSweepTest, RunGCTwice) { RunInNewThread([](mm::ThreadData& threadData) { GlobalObjectHolder global{threadData}; StackObjectHolder stack{threadData}; @@ -600,7 +600,7 @@ TEST_F(SameThreadMarkAndSweepTest, RunGCTwice) { }); } -TEST_F(SameThreadMarkAndSweepTest, PermanentObjects) { +TEST_F(ConcurrentMarkAndSweepTest, PermanentObjects) { RunInNewThread([](mm::ThreadData& threadData) { GlobalPermanentObjectHolder global1{threadData}; GlobalObjectHolder global2{threadData}; @@ -622,7 +622,7 @@ TEST_F(SameThreadMarkAndSweepTest, PermanentObjects) { }); } -TEST_F(SameThreadMarkAndSweepTest, SameObjectInRootSet) { +TEST_F(ConcurrentMarkAndSweepTest, SameObjectInRootSet) { RunInNewThread([](mm::ThreadData& threadData) { GlobalObjectHolder global{threadData}; StackObjectHolder stack(*global); @@ -746,7 +746,7 @@ private: } // namespace -TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsCollect) { +TEST_F(ConcurrentMarkAndSweepTest, MultipleMutatorsCollect) { KStdVector mutators(kDefaultThreadCount); KStdVector globals(kDefaultThreadCount); KStdVector locals(kDefaultThreadCount); @@ -802,7 +802,7 @@ TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsCollect) { } } -TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsAllCollect) { +TEST_F(ConcurrentMarkAndSweepTest, MultipleMutatorsAllCollect) { KStdVector mutators(kDefaultThreadCount); KStdVector globals(kDefaultThreadCount); KStdVector locals(kDefaultThreadCount); @@ -852,7 +852,7 @@ TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsAllCollect) { } } -TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRequested) { +TEST_F(ConcurrentMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRequested) { KStdVector mutators(kDefaultThreadCount); KStdVector globals(kDefaultThreadCount); KStdVector locals(kDefaultThreadCount); @@ -924,7 +924,7 @@ TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRe } } -TEST_F(SameThreadMarkAndSweepTest, CrossThreadReference) { +TEST_F(ConcurrentMarkAndSweepTest, CrossThreadReference) { KStdVector mutators(kDefaultThreadCount); KStdVector globals(kDefaultThreadCount); KStdVector locals(kDefaultThreadCount); @@ -990,7 +990,7 @@ TEST_F(SameThreadMarkAndSweepTest, CrossThreadReference) { } } -TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsWeaks) { +TEST_F(ConcurrentMarkAndSweepTest, MultipleMutatorsWeaks) { KStdVector mutators(kDefaultThreadCount); ObjHeader* globalRoot = nullptr; WeakCounter* weak = nullptr; @@ -1042,7 +1042,7 @@ TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsWeaks) { } } -TEST_F(SameThreadMarkAndSweepTest, NewThreadsWhileRequestingCollection) { +TEST_F(ConcurrentMarkAndSweepTest, NewThreadsWhileRequestingCollection) { KStdVector mutators(kDefaultThreadCount); KStdVector globals(2 * kDefaultThreadCount); KStdVector locals(2 * kDefaultThreadCount); @@ -1124,7 +1124,7 @@ TEST_F(SameThreadMarkAndSweepTest, NewThreadsWhileRequestingCollection) { } -TEST_F(SameThreadMarkAndSweepTest, FreeObjectWithFreeWeakReversedOrder) { +TEST_F(ConcurrentMarkAndSweepTest, FreeObjectWithFreeWeakReversedOrder) { KStdVector mutators(2); std::atomic*> object1 = nullptr; std::atomic weak = nullptr; diff --git a/kotlin-native/runtime/src/gc/cms/cpp/GC.hpp b/kotlin-native/runtime/src/gc/cms/cpp/GC.hpp index b386cdb4808..2e309a267c3 100644 --- a/kotlin-native/runtime/src/gc/cms/cpp/GC.hpp +++ b/kotlin-native/runtime/src/gc/cms/cpp/GC.hpp @@ -5,12 +5,12 @@ #pragma once -#include "SameThreadMarkAndSweep.hpp" +#include "ConcurrentMarkAndSweep.hpp" namespace kotlin { namespace gc { -using GC = kotlin::gc::SameThreadMarkAndSweep; +using GC = kotlin::gc::ConcurrentMarkAndSweep; inline constexpr bool kSupportsMultipleMutators = true;