Rename SingleThreadMarkAndSweep into SameThreadMarkAndSweep

This commit is contained in:
Alexander Shabalin
2021-06-03 13:18:42 +03:00
committed by Space
parent 9ebba93dd9
commit cf47d95aa5
8 changed files with 66 additions and 67 deletions
@@ -279,18 +279,18 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
} }
} }
put(GARBAGE_COLLECTOR, when (arguments.gc) { put(GARBAGE_COLLECTOR, when (arguments.gc) {
null -> GC.SINGLE_THREAD_MARK_SWEEP null -> GC.SAME_THREAD_MARK_AND_SWEEP
"noop" -> { "noop" -> {
assertGcSupported() assertGcSupported()
GC.NOOP GC.NOOP
} }
"stms" -> { "stms" -> {
assertGcSupported() assertGcSupported()
GC.SINGLE_THREAD_MARK_SWEEP GC.SAME_THREAD_MARK_AND_SWEEP
} }
else -> { else -> {
configuration.report(ERROR, "Unsupported GC ${arguments.gc}") configuration.report(ERROR, "Unsupported GC ${arguments.gc}")
GC.SINGLE_THREAD_MARK_SWEEP GC.SAME_THREAD_MARK_AND_SWEEP
} }
}) })
} }
@@ -7,5 +7,5 @@ package org.jetbrains.kotlin.backend.konan
enum class GC { enum class GC {
NOOP, NOOP,
SINGLE_THREAD_MARK_SWEEP, SAME_THREAD_MARK_AND_SWEEP,
} }
@@ -164,9 +164,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
MemoryModel.EXPERIMENTAL -> { MemoryModel.EXPERIMENTAL -> {
add("common_gc.bc") add("common_gc.bc")
when (gc) { when (gc) {
GC.SINGLE_THREAD_MARK_SWEEP -> { GC.SAME_THREAD_MARK_AND_SWEEP -> {
add("experimental_memory_manager_stms.bc") add("experimental_memory_manager_stms.bc")
add("single_thread_ms_gc.bc") add("same_thread_ms_gc.bc")
} }
GC.NOOP -> { GC.NOOP -> {
add("experimental_memory_manager_noop.bc") add("experimental_memory_manager_noop.bc")
+4 -4
View File
@@ -44,7 +44,7 @@ bitcode {
"${target}ExperimentalMemoryManagerNoop", "${target}ExperimentalMemoryManagerNoop",
"${target}ExperimentalMemoryManagerStms", "${target}ExperimentalMemoryManagerStms",
"${target}CommonGc", "${target}CommonGc",
"${target}SingleThreadMsGc", "${target}SameThreadMsGc",
"${target}NoopGc" "${target}NoopGc"
) )
includeRuntime() includeRuntime()
@@ -126,7 +126,7 @@ bitcode {
includeRuntime() includeRuntime()
} }
create("single_thread_ms_gc", file("src/gc/stms")) { create("same_thread_ms_gc", file("src/gc/stms")) {
headersDirs += files("src/gc/stms/cpp", "src/gc/common/cpp", "src/mm/cpp") headersDirs += files("src/gc/stms/cpp", "src/gc/common/cpp", "src/mm/cpp")
includeRuntime() includeRuntime()
} }
@@ -174,7 +174,7 @@ targetList.forEach { targetName ->
"${targetName}Runtime", "${targetName}Runtime",
"${targetName}ExperimentalMemoryManagerStms", "${targetName}ExperimentalMemoryManagerStms",
"${targetName}CommonGc", "${targetName}CommonGc",
"${targetName}SingleThreadMsGc", "${targetName}SameThreadMsGc",
"${targetName}Release", "${targetName}Release",
"${targetName}Mimalloc", "${targetName}Mimalloc",
"${targetName}OptAlloc" "${targetName}OptAlloc"
@@ -192,7 +192,7 @@ targetList.forEach { targetName ->
"${targetName}Runtime", "${targetName}Runtime",
"${targetName}ExperimentalMemoryManagerStms", "${targetName}ExperimentalMemoryManagerStms",
"${targetName}CommonGc", "${targetName}CommonGc",
"${targetName}SingleThreadMsGc", "${targetName}SameThreadMsGc",
"${targetName}Release", "${targetName}Release",
"${targetName}StdAlloc" "${targetName}StdAlloc"
) )
+2 -2
View File
@@ -6,12 +6,12 @@
#ifndef RUNTIME_GC_STMS_GC_H #ifndef RUNTIME_GC_STMS_GC_H
#define RUNTIME_GC_STMS_GC_H #define RUNTIME_GC_STMS_GC_H
#include "SingleThreadMarkAndSweep.hpp" #include "SameThreadMarkAndSweep.hpp"
namespace kotlin { namespace kotlin {
namespace gc { namespace gc {
using GC = kotlin::gc::SingleThreadMarkAndSweep; using GC = kotlin::gc::SameThreadMarkAndSweep;
inline constexpr bool kSupportsMultipleMutators = true; inline constexpr bool kSupportsMultipleMutators = true;
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file. * that can be found in the LICENSE file.
*/ */
#include "SingleThreadMarkAndSweep.hpp" #include "SameThreadMarkAndSweep.hpp"
#include "GlobalData.hpp" #include "GlobalData.hpp"
#include "MarkAndSweepUtils.hpp" #include "MarkAndSweepUtils.hpp"
@@ -20,48 +20,48 @@ namespace {
struct MarkTraits { struct MarkTraits {
static bool IsMarked(ObjHeader* object) noexcept { static bool IsMarked(ObjHeader* object) noexcept {
auto& objectData = mm::ObjectFactory<gc::SingleThreadMarkAndSweep>::NodeRef::From(object).GCObjectData(); auto& objectData = mm::ObjectFactory<gc::SameThreadMarkAndSweep>::NodeRef::From(object).GCObjectData();
return objectData.color() == gc::SingleThreadMarkAndSweep::ObjectData::Color::kBlack; return objectData.color() == gc::SameThreadMarkAndSweep::ObjectData::Color::kBlack;
} }
static bool TryMark(ObjHeader* object) noexcept { static bool TryMark(ObjHeader* object) noexcept {
auto& objectData = mm::ObjectFactory<gc::SingleThreadMarkAndSweep>::NodeRef::From(object).GCObjectData(); auto& objectData = mm::ObjectFactory<gc::SameThreadMarkAndSweep>::NodeRef::From(object).GCObjectData();
if (objectData.color() == gc::SingleThreadMarkAndSweep::ObjectData::Color::kBlack) return false; if (objectData.color() == gc::SameThreadMarkAndSweep::ObjectData::Color::kBlack) return false;
objectData.setColor(gc::SingleThreadMarkAndSweep::ObjectData::Color::kBlack); objectData.setColor(gc::SameThreadMarkAndSweep::ObjectData::Color::kBlack);
return true; return true;
}; };
}; };
struct SweepTraits { struct SweepTraits {
using ObjectFactory = mm::ObjectFactory<gc::SingleThreadMarkAndSweep>; using ObjectFactory = mm::ObjectFactory<gc::SameThreadMarkAndSweep>;
static bool TryResetMark(ObjectFactory::NodeRef node) noexcept { static bool TryResetMark(ObjectFactory::NodeRef node) noexcept {
auto& objectData = node.GCObjectData(); auto& objectData = node.GCObjectData();
if (objectData.color() == gc::SingleThreadMarkAndSweep::ObjectData::Color::kWhite) return false; if (objectData.color() == gc::SameThreadMarkAndSweep::ObjectData::Color::kWhite) return false;
objectData.setColor(gc::SingleThreadMarkAndSweep::ObjectData::Color::kWhite); objectData.setColor(gc::SameThreadMarkAndSweep::ObjectData::Color::kWhite);
return true; return true;
} }
}; };
struct FinalizeTraits { struct FinalizeTraits {
using ObjectFactory = mm::ObjectFactory<gc::SingleThreadMarkAndSweep>; using ObjectFactory = mm::ObjectFactory<gc::SameThreadMarkAndSweep>;
}; };
} // namespace } // namespace
void gc::SingleThreadMarkAndSweep::ThreadData::SafePointFunctionEpilogue() noexcept { void gc::SameThreadMarkAndSweep::ThreadData::SafePointFunctionEpilogue() noexcept {
SafePointRegular(1); SafePointRegular(1);
} }
void gc::SingleThreadMarkAndSweep::ThreadData::SafePointLoopBody() noexcept { void gc::SameThreadMarkAndSweep::ThreadData::SafePointLoopBody() noexcept {
SafePointRegular(1); SafePointRegular(1);
} }
void gc::SingleThreadMarkAndSweep::ThreadData::SafePointExceptionUnwind() noexcept { void gc::SameThreadMarkAndSweep::ThreadData::SafePointExceptionUnwind() noexcept {
SafePointRegular(1); SafePointRegular(1);
} }
void gc::SingleThreadMarkAndSweep::ThreadData::SafePointAllocation(size_t size) noexcept { void gc::SameThreadMarkAndSweep::ThreadData::SafePointAllocation(size_t size) noexcept {
size_t allocationOverhead = size_t allocationOverhead =
gc_.GetAllocationThresholdBytes() == 0 ? allocatedBytes_ : allocatedBytes_ % gc_.GetAllocationThresholdBytes(); gc_.GetAllocationThresholdBytes() == 0 ? allocatedBytes_ : allocatedBytes_ % gc_.GetAllocationThresholdBytes();
if (threadData_.suspensionData().suspendIfRequested()) { if (threadData_.suspensionData().suspendIfRequested()) {
@@ -73,8 +73,8 @@ void gc::SingleThreadMarkAndSweep::ThreadData::SafePointAllocation(size_t size)
allocatedBytes_ += size; allocatedBytes_ += size;
} }
void gc::SingleThreadMarkAndSweep::ThreadData::PerformFullGC() noexcept { void gc::SameThreadMarkAndSweep::ThreadData::PerformFullGC() noexcept {
mm::ObjectFactory<gc::SingleThreadMarkAndSweep>::FinalizerQueue finalizerQueue; mm::ObjectFactory<gc::SameThreadMarkAndSweep>::FinalizerQueue finalizerQueue;
{ {
// Switch state to native to simulate this thread being a GC thread. // Switch state to native to simulate this thread being a GC thread.
// As a bonus, if we failed to suspend threads (which means some other thread asked for a GC), // As a bonus, if we failed to suspend threads (which means some other thread asked for a GC),
@@ -94,11 +94,11 @@ void gc::SingleThreadMarkAndSweep::ThreadData::PerformFullGC() noexcept {
finalizerQueue.Finalize(); finalizerQueue.Finalize();
} }
void gc::SingleThreadMarkAndSweep::ThreadData::OnOOM(size_t size) noexcept { void gc::SameThreadMarkAndSweep::ThreadData::OnOOM(size_t size) noexcept {
PerformFullGC(); PerformFullGC();
} }
void gc::SingleThreadMarkAndSweep::ThreadData::SafePointRegular(size_t weight) noexcept { void gc::SameThreadMarkAndSweep::ThreadData::SafePointRegular(size_t weight) noexcept {
size_t counterOverhead = gc_.GetThreshold() == 0 ? safePointsCounter_ : safePointsCounter_ % gc_.GetThreshold(); size_t counterOverhead = gc_.GetThreshold() == 0 ? safePointsCounter_ : safePointsCounter_ % gc_.GetThreshold();
if (threadData_.suspensionData().suspendIfRequested()) { if (threadData_.suspensionData().suspendIfRequested()) {
safePointsCounter_ = 0; safePointsCounter_ = 0;
@@ -109,7 +109,7 @@ void gc::SingleThreadMarkAndSweep::ThreadData::SafePointRegular(size_t weight) n
safePointsCounter_ += weight; safePointsCounter_ += weight;
} }
mm::ObjectFactory<gc::SingleThreadMarkAndSweep>::FinalizerQueue gc::SingleThreadMarkAndSweep::PerformFullGC() noexcept { mm::ObjectFactory<gc::SameThreadMarkAndSweep>::FinalizerQueue gc::SameThreadMarkAndSweep::PerformFullGC() noexcept {
bool didSuspend = mm::SuspendThreads(); bool didSuspend = mm::SuspendThreads();
if (!didSuspend) { if (!didSuspend) {
// Somebody else suspended the threads, and so ran a GC. // Somebody else suspended the threads, and so ran a GC.
@@ -3,8 +3,8 @@
* that can be found in the LICENSE file. * that can be found in the LICENSE file.
*/ */
#ifndef RUNTIME_GC_STMS_SINGLE_THREAD_MARK_AND_SWEEP_H #ifndef RUNTIME_GC_STMS_SAME_THREAD_MARK_AND_SWEEP_H
#define RUNTIME_GC_STMS_SINGLE_THREAD_MARK_AND_SWEEP_H #define RUNTIME_GC_STMS_SAME_THREAD_MARK_AND_SWEEP_H
#include <cstddef> #include <cstddef>
@@ -21,8 +21,7 @@ class ThreadData;
namespace gc { namespace gc {
// Stop-the-world Mark-and-Sweep that runs on mutator threads. Can support targets that do not have threads. // Stop-the-world Mark-and-Sweep that runs on mutator threads. Can support targets that do not have threads.
// TODO: Rename it away from SingleThreadMarkAndSweep, but keep it STMS. class SameThreadMarkAndSweep : private Pinned {
class SingleThreadMarkAndSweep : private Pinned {
public: public:
class ObjectData { class ObjectData {
public: public:
@@ -41,9 +40,9 @@ public:
class ThreadData : private Pinned { class ThreadData : private Pinned {
public: public:
using ObjectData = SingleThreadMarkAndSweep::ObjectData; using ObjectData = SameThreadMarkAndSweep::ObjectData;
explicit ThreadData(SingleThreadMarkAndSweep& gc, mm::ThreadData& threadData) noexcept : gc_(gc), threadData_(threadData) {} explicit ThreadData(SameThreadMarkAndSweep& gc, mm::ThreadData& threadData) noexcept : gc_(gc), threadData_(threadData) {}
~ThreadData() = default; ~ThreadData() = default;
void SafePointFunctionEpilogue() noexcept; void SafePointFunctionEpilogue() noexcept;
@@ -58,14 +57,14 @@ public:
private: private:
void SafePointRegular(size_t weight) noexcept; void SafePointRegular(size_t weight) noexcept;
SingleThreadMarkAndSweep& gc_; SameThreadMarkAndSweep& gc_;
mm::ThreadData& threadData_; mm::ThreadData& threadData_;
size_t allocatedBytes_ = 0; size_t allocatedBytes_ = 0;
size_t safePointsCounter_ = 0; size_t safePointsCounter_ = 0;
}; };
SingleThreadMarkAndSweep() noexcept {} SameThreadMarkAndSweep() noexcept {}
~SingleThreadMarkAndSweep() = default; ~SameThreadMarkAndSweep() = default;
void SetThreshold(size_t value) noexcept { threshold_ = value; } void SetThreshold(size_t value) noexcept { threshold_ = value; }
size_t GetThreshold() noexcept { return threshold_; } size_t GetThreshold() noexcept { return threshold_; }
@@ -77,7 +76,7 @@ public:
bool GetAutoTune() noexcept { return autoTune_; } bool GetAutoTune() noexcept { return autoTune_; }
private: private:
mm::ObjectFactory<SingleThreadMarkAndSweep>::FinalizerQueue PerformFullGC() noexcept; mm::ObjectFactory<SameThreadMarkAndSweep>::FinalizerQueue PerformFullGC() noexcept;
size_t threshold_ = 1000; size_t threshold_ = 1000;
size_t allocationThresholdBytes_ = 10000; size_t allocationThresholdBytes_ = 10000;
@@ -87,4 +86,4 @@ private:
} // namespace gc } // namespace gc
} // namespace kotlin } // namespace kotlin
#endif // RUNTIME_GC_STMS_SINGLE_THREAD_MARK_AND_SWEEP_H #endif // RUNTIME_GC_STMS_SAME_THREAD_MARK_AND_SWEEP_H
@@ -3,7 +3,7 @@
* that can be found in the LICENSE file. * that can be found in the LICENSE file.
*/ */
#include "SingleThreadMarkAndSweep.hpp" #include "SameThreadMarkAndSweep.hpp"
#include <condition_variable> #include <condition_variable>
#include <future> #include <future>
@@ -23,7 +23,7 @@
using namespace kotlin; using namespace kotlin;
// These tests can only work if `GC` is `SingleThreadMarkAndSweep`. // These tests can only work if `GC` is `SameThreadMarkAndSweep`.
// TODO: Extracting GC into a separate module will help with this. // TODO: Extracting GC into a separate module will help with this.
namespace { namespace {
@@ -197,10 +197,10 @@ KStdVector<ObjHeader*> Alive(mm::ThreadData& threadData) {
return objects; return objects;
} }
using Color = gc::SingleThreadMarkAndSweep::ObjectData::Color; using Color = gc::SameThreadMarkAndSweep::ObjectData::Color;
Color GetColor(ObjHeader* objHeader) { Color GetColor(ObjHeader* objHeader) {
auto nodeRef = mm::ObjectFactory<gc::SingleThreadMarkAndSweep>::NodeRef::From(objHeader); auto nodeRef = mm::ObjectFactory<gc::SameThreadMarkAndSweep>::NodeRef::From(objHeader);
return nodeRef.GCObjectData().color(); return nodeRef.GCObjectData().color();
} }
@@ -213,9 +213,9 @@ WeakCounter& InstallWeakCounter(mm::ThreadData& threadData, ObjHeader* objHeader
return weakCounter; return weakCounter;
} }
class SingleThreadMarkAndSweepTest : public testing::Test { class SameThreadMarkAndSweepTest : public testing::Test {
public: public:
~SingleThreadMarkAndSweepTest() { ~SameThreadMarkAndSweepTest() {
mm::GlobalsRegistry::Instance().ClearForTests(); mm::GlobalsRegistry::Instance().ClearForTests();
mm::GlobalData::Instance().objectFactory().ClearForTests(); mm::GlobalData::Instance().objectFactory().ClearForTests();
} }
@@ -228,7 +228,7 @@ private:
} // namespace } // namespace
TEST_F(SingleThreadMarkAndSweepTest, RootSet) { TEST_F(SameThreadMarkAndSweepTest, RootSet) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalObjectHolder global1{threadData}; GlobalObjectHolder global1{threadData};
GlobalObjectArrayHolder global2{threadData}; GlobalObjectArrayHolder global2{threadData};
@@ -263,7 +263,7 @@ TEST_F(SingleThreadMarkAndSweepTest, RootSet) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, InterconnectedRootSet) { TEST_F(SameThreadMarkAndSweepTest, InterconnectedRootSet) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalObjectHolder global1{threadData}; GlobalObjectHolder global1{threadData};
GlobalObjectArrayHolder global2{threadData}; GlobalObjectArrayHolder global2{threadData};
@@ -309,7 +309,7 @@ TEST_F(SingleThreadMarkAndSweepTest, InterconnectedRootSet) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, FreeObjects) { TEST_F(SameThreadMarkAndSweepTest, FreeObjects) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
auto& object1 = AllocateObject(threadData); auto& object1 = AllocateObject(threadData);
auto& object2 = AllocateObject(threadData); auto& object2 = AllocateObject(threadData);
@@ -324,7 +324,7 @@ TEST_F(SingleThreadMarkAndSweepTest, FreeObjects) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, FreeObjectsWithFinalizers) { TEST_F(SameThreadMarkAndSweepTest, FreeObjectsWithFinalizers) {
RunInNewThread([this](mm::ThreadData& threadData) { RunInNewThread([this](mm::ThreadData& threadData) {
auto& object1 = AllocateObjectWithFinalizer(threadData); auto& object1 = AllocateObjectWithFinalizer(threadData);
auto& object2 = AllocateObjectWithFinalizer(threadData); auto& object2 = AllocateObjectWithFinalizer(threadData);
@@ -341,7 +341,7 @@ TEST_F(SingleThreadMarkAndSweepTest, FreeObjectsWithFinalizers) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, FreeObjectWithFreeWeak) { TEST_F(SameThreadMarkAndSweepTest, FreeObjectWithFreeWeak) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
auto& object1 = AllocateObject(threadData); auto& object1 = AllocateObject(threadData);
auto& weak1 = ([&threadData, &object1]() -> WeakCounter& { auto& weak1 = ([&threadData, &object1]() -> WeakCounter& {
@@ -360,7 +360,7 @@ TEST_F(SingleThreadMarkAndSweepTest, FreeObjectWithFreeWeak) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, FreeObjectWithHoldedWeak) { TEST_F(SameThreadMarkAndSweepTest, FreeObjectWithHoldedWeak) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
auto& object1 = AllocateObject(threadData); auto& object1 = AllocateObject(threadData);
StackObjectHolder stack{threadData}; StackObjectHolder stack{threadData};
@@ -379,7 +379,7 @@ TEST_F(SingleThreadMarkAndSweepTest, FreeObjectWithHoldedWeak) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, ObjectReferencedFromRootSet) { TEST_F(SameThreadMarkAndSweepTest, ObjectReferencedFromRootSet) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalObjectHolder global{threadData}; GlobalObjectHolder global{threadData};
StackObjectHolder stack{threadData}; StackObjectHolder stack{threadData};
@@ -419,7 +419,7 @@ TEST_F(SingleThreadMarkAndSweepTest, ObjectReferencedFromRootSet) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, ObjectsWithCycles) { TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCycles) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalObjectHolder global{threadData}; GlobalObjectHolder global{threadData};
StackObjectHolder stack{threadData}; StackObjectHolder stack{threadData};
@@ -468,7 +468,7 @@ TEST_F(SingleThreadMarkAndSweepTest, ObjectsWithCycles) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) { TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) {
RunInNewThread([this](mm::ThreadData& threadData) { RunInNewThread([this](mm::ThreadData& threadData) {
GlobalObjectHolder global{threadData}; GlobalObjectHolder global{threadData};
StackObjectHolder stack{threadData}; StackObjectHolder stack{threadData};
@@ -519,7 +519,7 @@ TEST_F(SingleThreadMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) { TEST_F(SameThreadMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalObjectHolder global{threadData}; GlobalObjectHolder global{threadData};
StackObjectHolder stack{threadData}; StackObjectHolder stack{threadData};
@@ -547,7 +547,7 @@ TEST_F(SingleThreadMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, RunGCTwice) { TEST_F(SameThreadMarkAndSweepTest, RunGCTwice) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalObjectHolder global{threadData}; GlobalObjectHolder global{threadData};
StackObjectHolder stack{threadData}; StackObjectHolder stack{threadData};
@@ -597,7 +597,7 @@ TEST_F(SingleThreadMarkAndSweepTest, RunGCTwice) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, PermanentObjects) { TEST_F(SameThreadMarkAndSweepTest, PermanentObjects) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalPermanentObjectHolder global1{threadData}; GlobalPermanentObjectHolder global1{threadData};
GlobalObjectHolder global2{threadData}; GlobalObjectHolder global2{threadData};
@@ -619,7 +619,7 @@ TEST_F(SingleThreadMarkAndSweepTest, PermanentObjects) {
}); });
} }
TEST_F(SingleThreadMarkAndSweepTest, SameObjectInRootSet) { TEST_F(SameThreadMarkAndSweepTest, SameObjectInRootSet) {
RunInNewThread([](mm::ThreadData& threadData) { RunInNewThread([](mm::ThreadData& threadData) {
GlobalObjectHolder global{threadData}; GlobalObjectHolder global{threadData};
StackObjectHolder stack(*global); StackObjectHolder stack(*global);
@@ -743,7 +743,7 @@ private:
} // namespace } // namespace
TEST_F(SingleThreadMarkAndSweepTest, MultipleMutatorsCollect) { TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsCollect) {
KStdVector<Mutator> mutators(kDefaultThreadCount); KStdVector<Mutator> mutators(kDefaultThreadCount);
KStdVector<ObjHeader*> globals(kDefaultThreadCount); KStdVector<ObjHeader*> globals(kDefaultThreadCount);
KStdVector<ObjHeader*> locals(kDefaultThreadCount); KStdVector<ObjHeader*> locals(kDefaultThreadCount);
@@ -799,7 +799,7 @@ TEST_F(SingleThreadMarkAndSweepTest, MultipleMutatorsCollect) {
} }
} }
TEST_F(SingleThreadMarkAndSweepTest, MultipleMutatorsAllCollect) { TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsAllCollect) {
KStdVector<Mutator> mutators(kDefaultThreadCount); KStdVector<Mutator> mutators(kDefaultThreadCount);
KStdVector<ObjHeader*> globals(kDefaultThreadCount); KStdVector<ObjHeader*> globals(kDefaultThreadCount);
KStdVector<ObjHeader*> locals(kDefaultThreadCount); KStdVector<ObjHeader*> locals(kDefaultThreadCount);
@@ -849,7 +849,7 @@ TEST_F(SingleThreadMarkAndSweepTest, MultipleMutatorsAllCollect) {
} }
} }
TEST_F(SingleThreadMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRequested) { TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRequested) {
KStdVector<Mutator> mutators(kDefaultThreadCount); KStdVector<Mutator> mutators(kDefaultThreadCount);
KStdVector<ObjHeader*> globals(kDefaultThreadCount); KStdVector<ObjHeader*> globals(kDefaultThreadCount);
KStdVector<ObjHeader*> locals(kDefaultThreadCount); KStdVector<ObjHeader*> locals(kDefaultThreadCount);
@@ -921,7 +921,7 @@ TEST_F(SingleThreadMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollection
} }
} }
TEST_F(SingleThreadMarkAndSweepTest, CrossThreadReference) { TEST_F(SameThreadMarkAndSweepTest, CrossThreadReference) {
KStdVector<Mutator> mutators(kDefaultThreadCount); KStdVector<Mutator> mutators(kDefaultThreadCount);
KStdVector<ObjHeader*> globals(kDefaultThreadCount); KStdVector<ObjHeader*> globals(kDefaultThreadCount);
KStdVector<ObjHeader*> locals(kDefaultThreadCount); KStdVector<ObjHeader*> locals(kDefaultThreadCount);
@@ -987,7 +987,7 @@ TEST_F(SingleThreadMarkAndSweepTest, CrossThreadReference) {
} }
} }
TEST_F(SingleThreadMarkAndSweepTest, MultipleMutatorsWeaks) { TEST_F(SameThreadMarkAndSweepTest, MultipleMutatorsWeaks) {
KStdVector<Mutator> mutators(kDefaultThreadCount); KStdVector<Mutator> mutators(kDefaultThreadCount);
ObjHeader* globalRoot = nullptr; ObjHeader* globalRoot = nullptr;
WeakCounter* weak = nullptr; WeakCounter* weak = nullptr;