[K/N] Move parallel-mark-concurrent-sweep GC sources
This commit is contained in:
committed by
Space Team
parent
48ce45e22f
commit
8726608973
+2
-2
@@ -363,13 +363,13 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
||||
when (gc) {
|
||||
GC.STOP_THE_WORLD_MARK_AND_SWEEP -> add("same_thread_ms_gc_custom.bc")
|
||||
GC.NOOP -> add("noop_gc_custom.bc")
|
||||
GC.PARALLEL_MARK_CONCURRENT_SWEEP -> add("concurrent_ms_gc_custom.bc")
|
||||
GC.PARALLEL_MARK_CONCURRENT_SWEEP -> add("pmcs_gc_custom.bc")
|
||||
}
|
||||
} else {
|
||||
when (gc) {
|
||||
GC.STOP_THE_WORLD_MARK_AND_SWEEP -> add("same_thread_ms_gc.bc")
|
||||
GC.NOOP -> add("noop_gc.bc")
|
||||
GC.PARALLEL_MARK_CONCURRENT_SWEEP -> add("concurrent_ms_gc.bc")
|
||||
GC.PARALLEL_MARK_CONCURRENT_SWEEP -> add("pmcs_gc.bc")
|
||||
}
|
||||
}
|
||||
if (shouldCoverLibraries || shouldCoverSources) add("profileRuntime.bc")
|
||||
|
||||
@@ -305,8 +305,8 @@ bitcode {
|
||||
compilerArgs.add("-DCUSTOM_ALLOCATOR")
|
||||
}
|
||||
|
||||
module("concurrent_ms_gc") {
|
||||
srcRoot.set(layout.projectDirectory.dir("src/gc/cms"))
|
||||
module("pmcs_gc") {
|
||||
srcRoot.set(layout.projectDirectory.dir("src/gc/pmcs"))
|
||||
headersDirs.from(files("src/alloc/common/cpp", "src/gcScheduler/common/cpp", "src/gc/common/cpp", "src/mm/cpp", "src/main/cpp", "src/alloc/legacy/cpp"))
|
||||
sourceSets {
|
||||
main {}
|
||||
@@ -314,8 +314,8 @@ bitcode {
|
||||
}
|
||||
}
|
||||
|
||||
module("concurrent_ms_gc_custom") {
|
||||
srcRoot.set(layout.projectDirectory.dir("src/gc/cms"))
|
||||
module("pmcs_gc_custom") {
|
||||
srcRoot.set(layout.projectDirectory.dir("src/gc/pmcs"))
|
||||
headersDirs.from(files("src/alloc/common/cpp", "src/gcScheduler/common/cpp", "src/gc/common/cpp", "src/mm/cpp", "src/main/cpp", "src/alloc/custom/cpp"))
|
||||
sourceSets {
|
||||
main {}
|
||||
@@ -387,16 +387,16 @@ bitcode {
|
||||
testSupportModules.addAll("main", "common_alloc", "common_gc", "common_gcScheduler", "manual_gcScheduler", "custom_alloc", "objc")
|
||||
}
|
||||
|
||||
testsGroup("experimentalMM_cms_mimalloc_runtime_tests") {
|
||||
testedModules.addAll("main", "mm", "common_alloc", "common_gc", "common_gcScheduler", "manual_gcScheduler", "concurrent_ms_gc", "mimalloc", "mimalloc_alloc", "legacy_alloc", "objc")
|
||||
testsGroup("experimentalMM_pmcs_mimalloc_runtime_tests") {
|
||||
testedModules.addAll("main", "mm", "common_alloc", "common_gc", "common_gcScheduler", "manual_gcScheduler", "pmcs_gc", "mimalloc", "mimalloc_alloc", "legacy_alloc", "objc")
|
||||
}
|
||||
|
||||
testsGroup("experimentalMM_cms_std_alloc_runtime_tests") {
|
||||
testedModules.addAll("main", "mm", "common_alloc", "common_gc", "common_gcScheduler", "manual_gcScheduler", "concurrent_ms_gc", "std_alloc", "legacy_alloc", "objc")
|
||||
testsGroup("experimentalMM_pmcs_std_alloc_runtime_tests") {
|
||||
testedModules.addAll("main", "mm", "common_alloc", "common_gc", "common_gcScheduler", "manual_gcScheduler", "pmcs_gc", "std_alloc", "legacy_alloc", "objc")
|
||||
}
|
||||
|
||||
testsGroup("experimentalMM_cms_custom_alloc_runtime_tests") {
|
||||
testedModules.addAll("mm", "concurrent_ms_gc_custom")
|
||||
testsGroup("experimentalMM_pmcs_custom_alloc_runtime_tests") {
|
||||
testedModules.addAll("mm", "pmcs_gc_custom")
|
||||
testSupportModules.addAll("main", "common_alloc", "common_gc", "common_gcScheduler", "manual_gcScheduler", "custom_alloc", "objc")
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ConcurrentMarkAndSweep.hpp"
|
||||
#include "ParallelMarkConcurrentSweep.hpp"
|
||||
#include "GC.hpp"
|
||||
#include "GCStatistics.hpp"
|
||||
#include "MarkAndSweepUtils.hpp"
|
||||
+5
-5
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "GC.hpp"
|
||||
|
||||
#include "ConcurrentMarkAndSweep.hpp"
|
||||
#include "ParallelMarkConcurrentSweep.hpp"
|
||||
|
||||
namespace kotlin {
|
||||
namespace gc {
|
||||
@@ -17,20 +17,20 @@ public:
|
||||
Impl(alloc::Allocator& allocator, gcScheduler::GCScheduler& gcScheduler) noexcept :
|
||||
gc_(allocator, gcScheduler, compiler::gcMutatorsCooperate(), compiler::auxGCThreads()) {}
|
||||
|
||||
ConcurrentMarkAndSweep& gc() noexcept { return gc_; }
|
||||
ParallelMarkConcurrentSweep& gc() noexcept { return gc_; }
|
||||
|
||||
private:
|
||||
ConcurrentMarkAndSweep gc_;
|
||||
ParallelMarkConcurrentSweep gc_;
|
||||
};
|
||||
|
||||
class GC::ThreadData::Impl : private Pinned {
|
||||
public:
|
||||
Impl(GC& gc, mm::ThreadData& threadData) noexcept : gc_(gc.impl_->gc(), threadData) {}
|
||||
|
||||
ConcurrentMarkAndSweep::ThreadData& gc() noexcept { return gc_; }
|
||||
ParallelMarkConcurrentSweep::ThreadData& gc() noexcept { return gc_; }
|
||||
|
||||
private:
|
||||
ConcurrentMarkAndSweep::ThreadData gc_;
|
||||
ParallelMarkConcurrentSweep::ThreadData gc_;
|
||||
};
|
||||
|
||||
} // namespace gc
|
||||
+16
-16
@@ -3,7 +3,7 @@
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "ConcurrentMarkAndSweep.hpp"
|
||||
#include "ParallelMarkConcurrentSweep.hpp"
|
||||
|
||||
#include <optional>
|
||||
|
||||
@@ -54,13 +54,13 @@ ScopedThread createGCThread(const char* name, Body&& body) {
|
||||
|
||||
} // namespace
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::ThreadData::OnSuspendForGC() noexcept {
|
||||
void gc::ParallelMarkConcurrentSweep::ThreadData::OnSuspendForGC() noexcept {
|
||||
CallsCheckerIgnoreGuard guard;
|
||||
|
||||
gc_.markDispatcher_.runOnMutator(commonThreadData());
|
||||
}
|
||||
|
||||
bool gc::ConcurrentMarkAndSweep::ThreadData::tryLockRootSet() {
|
||||
bool gc::ParallelMarkConcurrentSweep::ThreadData::tryLockRootSet() {
|
||||
bool expected = false;
|
||||
bool locked = rootSetLocked_.compare_exchange_strong(expected, true, std::memory_order_acq_rel);
|
||||
if (locked) {
|
||||
@@ -69,25 +69,25 @@ bool gc::ConcurrentMarkAndSweep::ThreadData::tryLockRootSet() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::ThreadData::publish() {
|
||||
void gc::ParallelMarkConcurrentSweep::ThreadData::publish() {
|
||||
threadData_.Publish();
|
||||
published_.store(true, std::memory_order_release);
|
||||
}
|
||||
|
||||
bool gc::ConcurrentMarkAndSweep::ThreadData::published() const {
|
||||
bool gc::ParallelMarkConcurrentSweep::ThreadData::published() const {
|
||||
return published_.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::ThreadData::clearMarkFlags() {
|
||||
void gc::ParallelMarkConcurrentSweep::ThreadData::clearMarkFlags() {
|
||||
published_.store(false, std::memory_order_relaxed);
|
||||
rootSetLocked_.store(false, std::memory_order_release);
|
||||
}
|
||||
|
||||
mm::ThreadData& gc::ConcurrentMarkAndSweep::ThreadData::commonThreadData() const {
|
||||
mm::ThreadData& gc::ParallelMarkConcurrentSweep::ThreadData::commonThreadData() const {
|
||||
return threadData_;
|
||||
}
|
||||
|
||||
gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(
|
||||
gc::ParallelMarkConcurrentSweep::ParallelMarkConcurrentSweep(
|
||||
alloc::Allocator& allocator, gcScheduler::GCScheduler& gcScheduler, bool mutatorsCooperate, std::size_t auxGCThreads) noexcept :
|
||||
allocator_(allocator),
|
||||
gcScheduler_(gcScheduler),
|
||||
@@ -103,26 +103,26 @@ gc::ConcurrentMarkAndSweep::ConcurrentMarkAndSweep(
|
||||
RuntimeLogInfo({kTagGC}, "Parallel Mark & Concurrent Sweep GC initialized");
|
||||
}
|
||||
|
||||
gc::ConcurrentMarkAndSweep::~ConcurrentMarkAndSweep() {
|
||||
gc::ParallelMarkConcurrentSweep::~ParallelMarkConcurrentSweep() {
|
||||
state_.shutdown();
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::StartFinalizerThreadIfNeeded() noexcept {
|
||||
void gc::ParallelMarkConcurrentSweep::StartFinalizerThreadIfNeeded() noexcept {
|
||||
NativeOrUnregisteredThreadGuard guard(true);
|
||||
finalizerProcessor_.StartFinalizerThreadIfNone();
|
||||
finalizerProcessor_.WaitFinalizerThreadInitialized();
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::StopFinalizerThreadIfRunning() noexcept {
|
||||
void gc::ParallelMarkConcurrentSweep::StopFinalizerThreadIfRunning() noexcept {
|
||||
NativeOrUnregisteredThreadGuard guard(true);
|
||||
finalizerProcessor_.StopFinalizerThread();
|
||||
}
|
||||
|
||||
bool gc::ConcurrentMarkAndSweep::FinalizersThreadIsRunning() noexcept {
|
||||
bool gc::ParallelMarkConcurrentSweep::FinalizersThreadIsRunning() noexcept {
|
||||
return finalizerProcessor_.IsRunning();
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::mainGCThreadBody() {
|
||||
void gc::ParallelMarkConcurrentSweep::mainGCThreadBody() {
|
||||
while (true) {
|
||||
auto epoch = state_.waitScheduled();
|
||||
if (epoch.has_value()) {
|
||||
@@ -134,14 +134,14 @@ void gc::ConcurrentMarkAndSweep::mainGCThreadBody() {
|
||||
markDispatcher_.requestShutdown();
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::auxiliaryGCThreadBody() {
|
||||
void gc::ParallelMarkConcurrentSweep::auxiliaryGCThreadBody() {
|
||||
RuntimeAssert(!compiler::gcMarkSingleThreaded(), "Should not reach here during single threaded mark");
|
||||
while (!markDispatcher_.shutdownRequested()) {
|
||||
markDispatcher_.runAuxiliary();
|
||||
}
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::PerformFullGC(int64_t epoch) noexcept {
|
||||
void gc::ParallelMarkConcurrentSweep::PerformFullGC(int64_t epoch) noexcept {
|
||||
std::unique_lock mainGCLock(gcMutex);
|
||||
auto gcHandle = GCHandle::create(epoch);
|
||||
|
||||
@@ -219,7 +219,7 @@ void gc::ConcurrentMarkAndSweep::PerformFullGC(int64_t epoch) noexcept {
|
||||
finalizerProcessor_.ScheduleTasks(std::move(finalizerQueue), epoch);
|
||||
}
|
||||
|
||||
void gc::ConcurrentMarkAndSweep::reconfigure(std::size_t maxParallelism, bool mutatorsCooperate, std::size_t auxGCThreads) noexcept {
|
||||
void gc::ParallelMarkConcurrentSweep::reconfigure(std::size_t maxParallelism, bool mutatorsCooperate, std::size_t auxGCThreads) noexcept {
|
||||
if (compiler::gcMarkSingleThreaded()) {
|
||||
RuntimeCheck(auxGCThreads == 0, "Auxiliary GC threads must not be created with gcMarkSingleThread");
|
||||
return;
|
||||
+6
-7
@@ -29,12 +29,11 @@ namespace kotlin {
|
||||
namespace gc {
|
||||
|
||||
// Stop-the-world parallel mark + concurrent sweep. The GC runs in a separate thread, finalizers run in another thread of their own.
|
||||
// TODO: Also make marking run concurrently with Kotlin threads.
|
||||
class ConcurrentMarkAndSweep : private Pinned {
|
||||
class ParallelMarkConcurrentSweep : private Pinned {
|
||||
public:
|
||||
class ThreadData : private Pinned {
|
||||
public:
|
||||
explicit ThreadData(ConcurrentMarkAndSweep& gc, mm::ThreadData& threadData) noexcept : gc_(gc), threadData_(threadData) {}
|
||||
explicit ThreadData(ParallelMarkConcurrentSweep& gc, mm::ThreadData& threadData) noexcept : gc_(gc), threadData_(threadData) {}
|
||||
~ThreadData() = default;
|
||||
|
||||
void OnSuspendForGC() noexcept;
|
||||
@@ -53,8 +52,8 @@ public:
|
||||
mm::ThreadData& commonThreadData() const;
|
||||
|
||||
private:
|
||||
friend ConcurrentMarkAndSweep;
|
||||
ConcurrentMarkAndSweep& gc_;
|
||||
friend ParallelMarkConcurrentSweep;
|
||||
ParallelMarkConcurrentSweep& gc_;
|
||||
mm::ThreadData& threadData_;
|
||||
BarriersThreadData barriers_;
|
||||
|
||||
@@ -62,9 +61,9 @@ public:
|
||||
std::atomic<bool> published_ = false;
|
||||
};
|
||||
|
||||
ConcurrentMarkAndSweep(
|
||||
ParallelMarkConcurrentSweep(
|
||||
alloc::Allocator& allocator, gcScheduler::GCScheduler& scheduler, bool mutatorsCooperate, std::size_t auxGCThreads) noexcept;
|
||||
~ConcurrentMarkAndSweep();
|
||||
~ParallelMarkConcurrentSweep();
|
||||
|
||||
void StartFinalizerThreadIfNeeded() noexcept;
|
||||
void StopFinalizerThreadIfRunning() noexcept;
|
||||
+27
-27
@@ -3,7 +3,7 @@
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "ConcurrentMarkAndSweep.hpp"
|
||||
#include "ParallelMarkConcurrentSweep.hpp"
|
||||
|
||||
#include <condition_variable>
|
||||
#include <future>
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
using namespace kotlin;
|
||||
|
||||
// These tests can only work if `GC` is `ConcurrentMarkAndSweep`.
|
||||
// These tests can only work if `GC` is `ParallelMarkConcurrentSweep`.
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -201,10 +201,10 @@ struct ParallelismOptions {
|
||||
std::size_t auxGCThreads;
|
||||
};
|
||||
|
||||
class ConcurrentMarkAndSweepTest : public testing::TestWithParam<ParallelismOptions> {
|
||||
class ParallelMarkConcurrentSweepTest : public testing::TestWithParam<ParallelismOptions> {
|
||||
public:
|
||||
|
||||
ConcurrentMarkAndSweepTest() {
|
||||
ParallelMarkConcurrentSweepTest() {
|
||||
if (supportedConfiguration()) {
|
||||
mm::GlobalData::Instance().gc().impl().gc().reconfigure(GetParam().maxParallelism,
|
||||
GetParam().cooperativeMutators,
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
~ConcurrentMarkAndSweepTest() {
|
||||
~ParallelMarkConcurrentSweepTest() {
|
||||
mm::GlobalsRegistry::Instance().ClearForTests();
|
||||
mm::SpecialRefRegistry::instance().clearForTests();
|
||||
mm::GlobalData::Instance().gc().ClearForTests();
|
||||
@@ -237,7 +237,7 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, RootSet) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, RootSet) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global1{threadData};
|
||||
GlobalObjectArrayHolder global2{threadData};
|
||||
@@ -272,7 +272,7 @@ TEST_P(ConcurrentMarkAndSweepTest, RootSet) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, InterconnectedRootSet) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, InterconnectedRootSet) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global1{threadData};
|
||||
GlobalObjectArrayHolder global2{threadData};
|
||||
@@ -318,7 +318,7 @@ TEST_P(ConcurrentMarkAndSweepTest, InterconnectedRootSet) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, FreeObjects) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, FreeObjects) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
auto& object1 = AllocateObject(threadData);
|
||||
auto& object2 = AllocateObject(threadData);
|
||||
@@ -333,7 +333,7 @@ TEST_P(ConcurrentMarkAndSweepTest, FreeObjects) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, FreeObjectsWithFinalizers) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, FreeObjectsWithFinalizers) {
|
||||
RunInNewThread([this](mm::ThreadData& threadData) {
|
||||
auto& object1 = AllocateObjectWithFinalizer(threadData);
|
||||
auto& object2 = AllocateObjectWithFinalizer(threadData);
|
||||
@@ -350,7 +350,7 @@ TEST_P(ConcurrentMarkAndSweepTest, FreeObjectsWithFinalizers) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, FreeObjectWithFreeWeak) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, FreeObjectWithFreeWeak) {
|
||||
RunInNewThread([this](mm::ThreadData& threadData) {
|
||||
auto& object1 = AllocateObject(threadData);
|
||||
auto& weak1 = ([&threadData, &object1]() -> test_support::RegularWeakReferenceImpl& {
|
||||
@@ -370,7 +370,7 @@ TEST_P(ConcurrentMarkAndSweepTest, FreeObjectWithFreeWeak) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, FreeObjectWithHoldedWeak) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, FreeObjectWithHoldedWeak) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
auto& object1 = AllocateObject(threadData);
|
||||
StackObjectHolder stack{threadData};
|
||||
@@ -389,7 +389,7 @@ TEST_P(ConcurrentMarkAndSweepTest, FreeObjectWithHoldedWeak) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, ObjectReferencedFromRootSet) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, ObjectReferencedFromRootSet) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global{threadData};
|
||||
StackObjectHolder stack{threadData};
|
||||
@@ -429,7 +429,7 @@ TEST_P(ConcurrentMarkAndSweepTest, ObjectReferencedFromRootSet) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, ObjectsWithCycles) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, ObjectsWithCycles) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global{threadData};
|
||||
StackObjectHolder stack{threadData};
|
||||
@@ -478,7 +478,7 @@ TEST_P(ConcurrentMarkAndSweepTest, ObjectsWithCycles) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, ObjectsWithCyclesAndFinalizers) {
|
||||
RunInNewThread([this](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global{threadData};
|
||||
StackObjectHolder stack{threadData};
|
||||
@@ -529,7 +529,7 @@ TEST_P(ConcurrentMarkAndSweepTest, ObjectsWithCyclesAndFinalizers) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, ObjectsWithCyclesIntoRootSet) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global{threadData};
|
||||
StackObjectHolder stack{threadData};
|
||||
@@ -557,7 +557,7 @@ TEST_P(ConcurrentMarkAndSweepTest, ObjectsWithCyclesIntoRootSet) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, RunGCTwice) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, RunGCTwice) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global{threadData};
|
||||
StackObjectHolder stack{threadData};
|
||||
@@ -607,7 +607,7 @@ TEST_P(ConcurrentMarkAndSweepTest, RunGCTwice) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, PermanentObjects) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, PermanentObjects) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalPermanentObjectHolder global1{threadData};
|
||||
GlobalObjectHolder global2{threadData};
|
||||
@@ -629,7 +629,7 @@ TEST_P(ConcurrentMarkAndSweepTest, PermanentObjects) {
|
||||
});
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, SameObjectInRootSet) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, SameObjectInRootSet) {
|
||||
RunInNewThread([](mm::ThreadData& threadData) {
|
||||
GlobalObjectHolder global{threadData};
|
||||
StackObjectHolder stack(*global);
|
||||
@@ -715,7 +715,7 @@ private:
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsCollect) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, MultipleMutatorsCollect) {
|
||||
std::vector<Mutator> mutators(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> globals(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> locals(kDefaultThreadCount);
|
||||
@@ -772,7 +772,7 @@ TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsCollect) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsAllCollect) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, MultipleMutatorsAllCollect) {
|
||||
std::vector<Mutator> mutators(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> globals(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> locals(kDefaultThreadCount);
|
||||
@@ -834,7 +834,7 @@ TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsAllCollect) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRequested) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRequested) {
|
||||
std::vector<Mutator> mutators(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> globals(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> locals(kDefaultThreadCount);
|
||||
@@ -905,7 +905,7 @@ TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsAddToRootSetAfterCollectionRe
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, CrossThreadReference) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, CrossThreadReference) {
|
||||
std::vector<Mutator> mutators(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> globals(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> locals(kDefaultThreadCount);
|
||||
@@ -972,7 +972,7 @@ TEST_P(ConcurrentMarkAndSweepTest, CrossThreadReference) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsWeaks) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, MultipleMutatorsWeaks) {
|
||||
std::vector<Mutator> mutators(kDefaultThreadCount);
|
||||
ObjHeader* globalRoot = nullptr;
|
||||
test_support::RegularWeakReferenceImpl* weak = nullptr;
|
||||
@@ -1026,7 +1026,7 @@ TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsWeaks) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsWeakNewObj) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, MultipleMutatorsWeakNewObj) {
|
||||
std::vector<Mutator> mutators(kDefaultThreadCount);
|
||||
|
||||
// Make sure all mutators are initialized.
|
||||
@@ -1072,7 +1072,7 @@ TEST_P(ConcurrentMarkAndSweepTest, MultipleMutatorsWeakNewObj) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, NewThreadsWhileRequestingCollection) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, NewThreadsWhileRequestingCollection) {
|
||||
std::vector<Mutator> mutators(kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> globals(2 * kDefaultThreadCount);
|
||||
std::vector<ObjHeader*> locals(2 * kDefaultThreadCount);
|
||||
@@ -1172,7 +1172,7 @@ TEST_P(ConcurrentMarkAndSweepTest, NewThreadsWhileRequestingCollection) {
|
||||
EXPECT_THAT(mutators[0].Alive(), testing::UnorderedElementsAreArray(expectedAlive));
|
||||
}
|
||||
|
||||
TEST_P(ConcurrentMarkAndSweepTest, FreeObjectWithFreeWeakReversedOrder) {
|
||||
TEST_P(ParallelMarkConcurrentSweepTest, FreeObjectWithFreeWeakReversedOrder) {
|
||||
std::vector<Mutator> mutators(2);
|
||||
std::atomic<test_support::Object<Payload>*> object1 = nullptr;
|
||||
std::atomic<test_support::RegularWeakReferenceImpl*> weak = nullptr;
|
||||
@@ -1215,7 +1215,7 @@ TEST_P(ConcurrentMarkAndSweepTest, FreeObjectWithFreeWeakReversedOrder) {
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(,
|
||||
ConcurrentMarkAndSweepTest,
|
||||
ParallelMarkConcurrentSweepTest,
|
||||
testing::Values(
|
||||
ParallelismOptions{kDefaultThreadCount * 3, false, 0},
|
||||
ParallelismOptions{kDefaultThreadCount * 3, true, 0}
|
||||
Reference in New Issue
Block a user