mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-06 23:54:03 +00:00
Delete unused gc code
Delete unused gc code Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAU807?from=project-issue Signed-off-by: lhc <liuhongchen5@huawei.com> Change-Id: I5acf5b6e0d8510dfc53323fdecfb9772fe00e6be
This commit is contained in:
parent
afe027a27d
commit
e7d1dc72ee
1
BUILD.gn
1
BUILD.gn
@ -870,7 +870,6 @@ ecma_source = [
|
||||
"ecmascript/mem/shared_heap/shared_full_gc.cpp",
|
||||
"ecmascript/mem/shared_heap/shared_gc_marker.cpp",
|
||||
"ecmascript/mem/shared_heap/shared_space.cpp",
|
||||
"ecmascript/mem/stw_young_gc.cpp",
|
||||
"ecmascript/mem/space.cpp",
|
||||
"ecmascript/mem/sparse_space.cpp",
|
||||
"ecmascript/mem/thread_local_allocation_buffer.cpp",
|
||||
|
@ -31,7 +31,6 @@ namespace panda::ecmascript {
|
||||
void GCStats::PrintStatisticResult()
|
||||
{
|
||||
LOG_GC(INFO) << "/******************* GCStats statistic: *******************/";
|
||||
PrintGCSummaryStatistic(GCType::STW_YOUNG_GC);
|
||||
PrintGCSummaryStatistic(GCType::PARTIAL_EDEN_GC);
|
||||
PrintGCSummaryStatistic(GCType::PARTIAL_YOUNG_GC);
|
||||
PrintGCSummaryStatistic(GCType::PARTIAL_OLD_GC);
|
||||
@ -164,17 +163,6 @@ void GCStats::PrintGCMemoryStatistic()
|
||||
<< STATS_DESCRIPTION_FORMAT("ChunkNativeSize:")
|
||||
<< STATS_DATA_FORMAT(sizeToKB(heap_->GetNativeAreaAllocator()->GetChunkNativeSize())) << "KB";
|
||||
switch (gcType_) {
|
||||
case GCType::STW_YOUNG_GC: {
|
||||
double copiedRate = double(GetRecordData(RecordData::SEMI_ALIVE_SIZE)) /
|
||||
GetRecordData(RecordData::SEMI_COMMIT_SIZE);
|
||||
double premotedRate = double(GetRecordData(RecordData::SEMI_PROMOTE_SIZE)) /
|
||||
GetRecordData(RecordData::SEMI_COMMIT_SIZE);
|
||||
double survivalRate = std::min(copiedRate + premotedRate, 1.0);
|
||||
LOG_GC(INFO) << STATS_DESCRIPTION_FORMAT("Young copied rate:") << STATS_DATA_FORMAT(copiedRate) << "\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Young promoted rate:") << STATS_DATA_FORMAT(premotedRate) << "\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Young survival rate:") << STATS_DATA_FORMAT(survivalRate);
|
||||
break;
|
||||
}
|
||||
case GCType::PARTIAL_EDEN_GC: {
|
||||
size_t commitSize = GetRecordData(RecordData::EDEN_COMMIT_SIZE);
|
||||
double copiedRate = commitSize == 0 ? 0 : (double(GetRecordData(RecordData::EDEN_ALIVE_SIZE)) / commitSize);
|
||||
@ -218,20 +206,6 @@ void GCStats::PrintGCDurationStatistic()
|
||||
{
|
||||
LOG_GC(INFO) << "/***************** GC Duration statistic: ****************/";
|
||||
switch (gcType_) {
|
||||
case GCType::STW_YOUNG_GC:
|
||||
LOG_GC(INFO) << STATS_DESCRIPTION_FORMAT("TotalGC:")
|
||||
<< STATS_DATA_FORMAT(scopeDuration_[Scope::ScopeId::TotalGC]) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Initialize:")
|
||||
<< STATS_DATA_FORMAT(scopeDuration_[Scope::ScopeId::Initialize]) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Mark:")
|
||||
<< STATS_DATA_FORMAT(scopeDuration_[Scope::ScopeId::Mark]) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("MarkRoots:")
|
||||
<< STATS_DATA_FORMAT(scopeDuration_[Scope::ScopeId::MarkRoots]) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Sweep:")
|
||||
<< STATS_DATA_FORMAT(scopeDuration_[Scope::ScopeId::Sweep]) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Finish:")
|
||||
<< STATS_DATA_FORMAT(scopeDuration_[Scope::ScopeId::Finish]) << "ms";
|
||||
break;
|
||||
case GCType::PARTIAL_EDEN_GC:
|
||||
case GCType::PARTIAL_YOUNG_GC:
|
||||
case GCType::PARTIAL_OLD_GC:
|
||||
@ -299,9 +273,6 @@ bool GCStats::CheckIfNeedPrint(GCType type)
|
||||
{
|
||||
uint32_t gcCount = 0;
|
||||
switch (type) {
|
||||
case GCType::STW_YOUNG_GC:
|
||||
gcCount = GetRecordData(RecordData::SEMI_COUNT);
|
||||
break;
|
||||
case GCType::PARTIAL_EDEN_GC:
|
||||
gcCount = GetRecordData(RecordData::EDEN_COUNT);
|
||||
break;
|
||||
@ -333,26 +304,6 @@ void GCStats::PrintGCSummaryStatistic(GCType type)
|
||||
}
|
||||
LOG_GC(INFO) << "/***************** GC summary statistic: *****************/";
|
||||
switch (type) {
|
||||
case GCType::STW_YOUNG_GC: {
|
||||
double copiedRate = double(GetRecordData(RecordData::SEMI_TOTAL_ALIVE)) /
|
||||
GetRecordData(RecordData::SEMI_TOTAL_COMMIT);
|
||||
double promotedRate = double(GetRecordData(RecordData::SEMI_TOTAL_PROMOTE)) /
|
||||
GetRecordData(RecordData::SEMI_TOTAL_COMMIT);
|
||||
double survivalRate = std::min(copiedRate + promotedRate, 1.0);
|
||||
LOG_GC(INFO) << STATS_DESCRIPTION_FORMAT("STWYoungGC occurs count")
|
||||
<< STATS_DATA_FORMAT(GetRecordData(RecordData::SEMI_COUNT)) << "\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("STWYoungGC max pause:")
|
||||
<< STATS_DATA_FORMAT(GetRecordDuration(RecordDuration::SEMI_MAX_PAUSE)) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("STWYoungGC min pause:")
|
||||
<< STATS_DATA_FORMAT(GetRecordDuration(RecordDuration::SEMI_MIN_PAUSE)) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("STWYoungGC average pause:")
|
||||
<< STATS_DATA_FORMAT(GetRecordDuration(RecordDuration::SEMI_TOTAL_PAUSE) /
|
||||
GetRecordData(RecordData::SEMI_COUNT)) << "ms\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Young average copied rate:") << STATS_DATA_FORMAT(copiedRate) << "\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Young average promoted rate:") << STATS_DATA_FORMAT(promotedRate) << "\n"
|
||||
<< STATS_DESCRIPTION_FORMAT("Young average survival rate:") << STATS_DATA_FORMAT(survivalRate);
|
||||
break;
|
||||
}
|
||||
case GCType::PARTIAL_EDEN_GC: {
|
||||
size_t commitSize = GetRecordData(RecordData::EDEN_TOTAL_COMMIT);
|
||||
double copiedRate =
|
||||
@ -445,12 +396,6 @@ void GCStats::RecordStatisticBeforeGC(TriggerGCType gcType, GCReason reason)
|
||||
reason_ = reason;
|
||||
|
||||
switch (gcType_) {
|
||||
case GCType::STW_YOUNG_GC: {
|
||||
size_t semiCommitSize = heap_->GetNewSpace()->GetCommittedSize();
|
||||
SetRecordData(RecordData::SEMI_COMMIT_SIZE, semiCommitSize);
|
||||
IncreaseRecordData(RecordData::SEMI_TOTAL_COMMIT, semiCommitSize);
|
||||
break;
|
||||
}
|
||||
case GCType::PARTIAL_EDEN_GC: {
|
||||
size_t edenCommitSize = heap_->GetEdenSpace()->GetCommittedSize();
|
||||
SetRecordData(RecordData::EDEN_COMMIT_SIZE, edenCommitSize);
|
||||
@ -488,26 +433,6 @@ void GCStats::RecordStatisticAfterGC()
|
||||
|
||||
float duration = scopeDuration_[Scope::ScopeId::TotalGC];
|
||||
switch (gcType_) {
|
||||
case GCType::STW_YOUNG_GC: {
|
||||
if (GetRecordData(RecordData::SEMI_COUNT) == 0) {
|
||||
SetRecordDuration(RecordDuration::SEMI_MIN_PAUSE, duration);
|
||||
SetRecordDuration(RecordDuration::SEMI_MAX_PAUSE, duration);
|
||||
} else {
|
||||
SetRecordDuration(RecordDuration::SEMI_MIN_PAUSE,
|
||||
std::min(GetRecordDuration(RecordDuration::SEMI_MIN_PAUSE), duration));
|
||||
SetRecordDuration(RecordDuration::SEMI_MAX_PAUSE,
|
||||
std::max(GetRecordDuration(RecordDuration::SEMI_MAX_PAUSE), duration));
|
||||
}
|
||||
IncreaseRecordData(RecordData::SEMI_COUNT);
|
||||
IncreaseRecordDuration(RecordDuration::SEMI_TOTAL_PAUSE, duration);
|
||||
size_t semiAliveSize = heap_->GetNewSpace()->GetHeapObjectSize();
|
||||
SetRecordData(RecordData::SEMI_ALIVE_SIZE, semiAliveSize);
|
||||
IncreaseRecordData(RecordData::SEMI_TOTAL_ALIVE, semiAliveSize);
|
||||
size_t promotedSize = heap_->GetPromotedSize();
|
||||
SetRecordData(RecordData::SEMI_PROMOTE_SIZE, promotedSize);
|
||||
IncreaseRecordData(RecordData::SEMI_TOTAL_PROMOTE, promotedSize);
|
||||
break;
|
||||
}
|
||||
case GCType::PARTIAL_EDEN_GC: {
|
||||
if (GetRecordData(RecordData::EDEN_COUNT) == 0) {
|
||||
SetRecordDuration(RecordDuration::EDEN_MIN_PAUSE, duration);
|
||||
|
@ -30,7 +30,6 @@ class Heap;
|
||||
class SharedHeap;
|
||||
|
||||
enum class GCType : int {
|
||||
STW_YOUNG_GC = 0,
|
||||
PARTIAL_EDEN_GC,
|
||||
PARTIAL_YOUNG_GC,
|
||||
PARTIAL_OLD_GC,
|
||||
@ -110,8 +109,6 @@ public:
|
||||
const char *GetGCTypeName()
|
||||
{
|
||||
switch (gcType_) {
|
||||
case GCType::STW_YOUNG_GC:
|
||||
return "STWYoungGC";
|
||||
case GCType::PARTIAL_EDEN_GC:
|
||||
return "HPP EdenGC";
|
||||
case GCType::PARTIAL_YOUNG_GC:
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "ecmascript/mem/shared_heap/shared_gc.h"
|
||||
#include "ecmascript/mem/shared_heap/shared_full_gc.h"
|
||||
#include "ecmascript/mem/shared_heap/shared_concurrent_marker.h"
|
||||
#include "ecmascript/mem/stw_young_gc.h"
|
||||
#include "ecmascript/mem/verification.h"
|
||||
#include "ecmascript/runtime_call_id.h"
|
||||
#include "ecmascript/jit/jit.h"
|
||||
@ -767,7 +766,6 @@ void Heap::Initialize()
|
||||
concurrentMarkerEnabled = false;
|
||||
#endif
|
||||
workManager_ = new WorkManager(this, Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1);
|
||||
stwYoungGC_ = new STWYoungGC(this, parallelGC_);
|
||||
fullGC_ = new FullGC(this);
|
||||
|
||||
partialGC_ = new PartialGC(this);
|
||||
@ -901,10 +899,6 @@ void Heap::Destroy()
|
||||
delete appSpawnSpace_;
|
||||
appSpawnSpace_ = nullptr;
|
||||
}
|
||||
if (stwYoungGC_ != nullptr) {
|
||||
delete stwYoungGC_;
|
||||
stwYoungGC_ = nullptr;
|
||||
}
|
||||
if (partialGC_ != nullptr) {
|
||||
delete partialGC_;
|
||||
partialGC_ = nullptr;
|
||||
@ -1038,7 +1032,6 @@ void Heap::DisableParallelGC()
|
||||
parallelGC_ = false;
|
||||
maxEvacuateTaskCount_ = 0;
|
||||
maxMarkTaskCount_ = 0;
|
||||
stwYoungGC_->ConfigParallelGC(false);
|
||||
sweeper_->ConfigConcurrentSweep(false);
|
||||
concurrentMarker_->ConfigConcurrentMark(false);
|
||||
Taskpool::GetCurrentTaskpool()->Destroy(GetJSThread()->GetThreadId());
|
||||
@ -1063,7 +1056,6 @@ void Heap::EnableParallelGC()
|
||||
#if ECMASCRIPT_DISABLE_CONCURRENT_MARKING
|
||||
concurrentMarkerEnabled = false;
|
||||
#endif
|
||||
stwYoungGC_->ConfigParallelGC(parallelGC_);
|
||||
sweeper_->ConfigConcurrentSweep(ecmaVm_->GetJSOptions().EnableConcurrentSweep());
|
||||
concurrentMarker_->ConfigConcurrentMark(concurrentMarkerEnabled);
|
||||
}
|
||||
@ -2528,7 +2520,6 @@ void Heap::UpdateWorkManager(WorkManager *workManager)
|
||||
{
|
||||
concurrentMarker_->workManager_ = workManager;
|
||||
fullGC_->workManager_ = workManager;
|
||||
stwYoungGC_->workManager_ = workManager;
|
||||
incrementalMarker_->workManager_ = workManager;
|
||||
nonMovableMarker_->workManager_ = workManager;
|
||||
semiGCMarker_->workManager_ = workManager;
|
||||
|
@ -61,7 +61,6 @@ class SharedGCMarkerBase;
|
||||
class SharedGCMarker;
|
||||
class SharedFullGC;
|
||||
class SharedGCMovableMarker;
|
||||
class STWYoungGC;
|
||||
class ThreadLocalAllocationBuffer;
|
||||
class JSThread;
|
||||
class DaemonThread;
|
||||
@ -946,11 +945,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
STWYoungGC *GetSTWYoungGC() const
|
||||
{
|
||||
return stwYoungGC_;
|
||||
}
|
||||
|
||||
PartialGC *GetPartialGC() const
|
||||
{
|
||||
return partialGC_;
|
||||
@ -1637,12 +1631,6 @@ private:
|
||||
* Garbage collectors collecting garbage in different scopes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Semi sapce GC which collects garbage only in young spaces.
|
||||
* This is however optional for now because the partial GC also covers its functionality.
|
||||
*/
|
||||
STWYoungGC *stwYoungGC_ {nullptr};
|
||||
|
||||
/*
|
||||
* The mostly used partial GC which collects garbage in young spaces,
|
||||
* and part of old spaces if needed determined by GC heuristics.
|
||||
|
@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecmascript/mem/stw_young_gc.h"
|
||||
#include "ecmascript/mem/concurrent_marker.h"
|
||||
#include "ecmascript/mem/parallel_marker-inl.h"
|
||||
#include "ecmascript/runtime_call_id.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
STWYoungGC::STWYoungGC(Heap *heap, bool parallelGC)
|
||||
: heap_(heap), parallelGC_(parallelGC), workManager_(heap->GetWorkManager())
|
||||
{
|
||||
}
|
||||
|
||||
void STWYoungGC::RunPhases()
|
||||
{
|
||||
MEM_ALLOCATE_AND_GC_TRACE(heap_->GetEcmaVM(), STWYoungGC_RunPhases);
|
||||
TRACE_GC(GCStats::Scope::ScopeId::TotalGC, heap_->GetEcmaVM()->GetEcmaGCStats());
|
||||
|
||||
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "STWYoungGC::RunPhases");
|
||||
if (heap_->CheckOngoingConcurrentMarking()) {
|
||||
LOG_GC(DEBUG) << "STWYoungGC after ConcurrentMarking";
|
||||
heap_->GetConcurrentMarker()->Reset(); // HPPGC use mark result to move TaggedObject.
|
||||
}
|
||||
Initialize();
|
||||
Mark();
|
||||
Sweep();
|
||||
Finish();
|
||||
}
|
||||
|
||||
void STWYoungGC::Initialize()
|
||||
{
|
||||
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "STWYoungGC::Initialize");
|
||||
TRACE_GC(GCStats::Scope::ScopeId::Initialize, heap_->GetEcmaVM()->GetEcmaGCStats());
|
||||
heap_->Prepare();
|
||||
commitSize_ = heap_->GetNewSpace()->GetCommittedSize();
|
||||
heap_->SwapNewSpace();
|
||||
workManager_->Initialize(TriggerGCType::YOUNG_GC, ParallelGCTaskPhase::SEMI_HANDLE_GLOBAL_POOL_TASK);
|
||||
heap_->GetSemiGCMarker()->Initialize();
|
||||
promotedSize_ = 0;
|
||||
semiCopiedSize_ = 0;
|
||||
}
|
||||
|
||||
void STWYoungGC::Mark()
|
||||
{
|
||||
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "STWYoungGC::Mark");
|
||||
TRACE_GC(GCStats::Scope::ScopeId::Mark, heap_->GetEcmaVM()->GetEcmaGCStats());
|
||||
auto region = heap_->GetOldSpace()->GetCurrentRegion();
|
||||
|
||||
if (parallelGC_) {
|
||||
heap_->PostParallelGCTask(ParallelGCTaskPhase::SEMI_HANDLE_THREAD_ROOTS_TASK);
|
||||
heap_->PostParallelGCTask(ParallelGCTaskPhase::SEMI_HANDLE_SNAPSHOT_TASK);
|
||||
heap_->GetSemiGCMarker()->ProcessOldToNew(0, region);
|
||||
} else {
|
||||
heap_->GetSemiGCMarker()->ProcessOldToNew(0, region);
|
||||
heap_->GetSemiGCMarker()->ProcessSnapshotRSet(MAIN_THREAD_INDEX);
|
||||
heap_->GetSemiGCMarker()->MarkRoots(MAIN_THREAD_INDEX, VMRootVisitType::UPDATE_ROOT);
|
||||
heap_->GetSemiGCMarker()->ProcessMarkStack(MAIN_THREAD_INDEX);
|
||||
}
|
||||
heap_->WaitRunningTaskFinished();
|
||||
|
||||
auto totalThreadCount = Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1; // gc thread and main thread
|
||||
for (uint32_t i = 0; i < totalThreadCount; i++) {
|
||||
SlotNeedUpdate needUpdate(nullptr, ObjectSlot(0));
|
||||
while (workManager_->GetSlotNeedUpdate(i, &needUpdate)) {
|
||||
UpdatePromotedSlot(needUpdate.first, needUpdate.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void STWYoungGC::Sweep()
|
||||
{
|
||||
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "STWYoungGC::Sweep");
|
||||
TRACE_GC(GCStats::Scope::ScopeId::Sweep, heap_->GetEcmaVM()->GetEcmaGCStats());
|
||||
auto totalThreadCount = static_cast<uint32_t>(
|
||||
Taskpool::GetCurrentTaskpool()->GetTotalThreadNum() + 1); // gc thread and main thread
|
||||
for (uint32_t i = 0; i < totalThreadCount; i++) {
|
||||
ProcessQueue *queue = workManager_->GetWeakReferenceQueue(i);
|
||||
while (true) {
|
||||
auto obj = queue->PopBack();
|
||||
if (UNLIKELY(obj == nullptr)) {
|
||||
break;
|
||||
}
|
||||
ObjectSlot slot(ToUintPtr(obj));
|
||||
JSTaggedValue value(slot.GetTaggedType());
|
||||
auto header = value.GetTaggedWeakRef();
|
||||
MarkWord markWord(header);
|
||||
if (markWord.IsForwardingAddress()) {
|
||||
TaggedObject *dst = markWord.ToForwardingAddress();
|
||||
auto weakRef = JSTaggedValue(JSTaggedValue(dst).CreateAndGetWeakRef()).GetRawTaggedObject();
|
||||
slot.Update(weakRef);
|
||||
} else {
|
||||
slot.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
WeakRootVisitor gcUpdateWeak = [](TaggedObject *header) -> TaggedObject* {
|
||||
Region *objectRegion = Region::ObjectAddressToRange(reinterpret_cast<TaggedObject *>(header));
|
||||
if (objectRegion->InGeneralOldSpace()) {
|
||||
return header;
|
||||
}
|
||||
|
||||
MarkWord markWord(header);
|
||||
if (markWord.IsForwardingAddress()) {
|
||||
TaggedObject *dst = markWord.ToForwardingAddress();
|
||||
return dst;
|
||||
}
|
||||
return nullptr;
|
||||
};
|
||||
heap_->GetEcmaVM()->GetJSThread()->IterateWeakEcmaGlobalStorage(gcUpdateWeak);
|
||||
heap_->GetEcmaVM()->ProcessReferences(gcUpdateWeak);
|
||||
}
|
||||
|
||||
void STWYoungGC::Finish()
|
||||
{
|
||||
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "STWYoungGC::Finish");
|
||||
TRACE_GC(GCStats::Scope::ScopeId::Finish, heap_->GetEcmaVM()->GetEcmaGCStats());
|
||||
workManager_->Finish(semiCopiedSize_, promotedSize_);
|
||||
heap_->Resume(YOUNG_GC);
|
||||
}
|
||||
} // namespace panda::ecmascript
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ECMASCRIPT_MEM_STW_YOUNG_GC_H
|
||||
#define ECMASCRIPT_MEM_STW_YOUNG_GC_H
|
||||
|
||||
#include "ecmascript/mem/allocator.h"
|
||||
#include "ecmascript/mem/clock_scope.h"
|
||||
#include "ecmascript/mem/garbage_collector.h"
|
||||
#include "ecmascript/mem/heap.h"
|
||||
#include "ecmascript/mem/mark_stack.h"
|
||||
#include "ecmascript/mem/mark_word.h"
|
||||
#include "ecmascript/mem/mem.h"
|
||||
#include "ecmascript/mem/slots.h"
|
||||
#include "ecmascript/mem/tlab_allocator.h"
|
||||
#include "ecmascript/mem/visitor.h"
|
||||
#include "ecmascript/mem/work_manager.h"
|
||||
|
||||
#include "ecmascript/platform/mutex.h"
|
||||
|
||||
namespace panda {
|
||||
namespace ecmascript {
|
||||
class STWYoungGC : public GarbageCollector {
|
||||
public:
|
||||
STWYoungGC(Heap *heap, bool parallelGC);
|
||||
~STWYoungGC() override = default;
|
||||
NO_COPY_SEMANTIC(STWYoungGC);
|
||||
NO_MOVE_SEMANTIC(STWYoungGC);
|
||||
|
||||
void ConfigParallelGC(bool parallelGC)
|
||||
{
|
||||
parallelGC_ = parallelGC;
|
||||
}
|
||||
virtual void RunPhases() override;
|
||||
|
||||
protected:
|
||||
virtual void Initialize() override;
|
||||
virtual void Mark() override;
|
||||
virtual void Sweep() override;
|
||||
virtual void Finish() override;
|
||||
|
||||
private:
|
||||
inline void UpdatePromotedSlot(TaggedObject *object, ObjectSlot slot)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
JSTaggedValue value(slot.GetTaggedType());
|
||||
ASSERT(value.IsHeapObject());
|
||||
#endif
|
||||
Region *objectRegion = Region::ObjectAddressToRange(object);
|
||||
ASSERT(objectRegion->InGeneralOldSpace());
|
||||
objectRegion->InsertOldToNewRSet(slot.SlotAddress());
|
||||
}
|
||||
|
||||
Heap *heap_;
|
||||
size_t promotedSize_ {0};
|
||||
size_t semiCopiedSize_ {0};
|
||||
size_t commitSize_ {0};
|
||||
|
||||
// obtain from heap
|
||||
bool parallelGC_ {false};
|
||||
WorkManager *workManager_ {nullptr};
|
||||
|
||||
friend class TlabAllocator;
|
||||
friend class WorkManager;
|
||||
friend class Heap;
|
||||
};
|
||||
} // namespace ecmascript
|
||||
} // namespace panda
|
||||
|
||||
#endif // ECMASCRIPT_MEM_STW_YOUNG_GC_H
|
@ -1230,7 +1230,6 @@ namespace panda::ecmascript {
|
||||
#define MEM_ALLOCATE_AND_GC_LIST(V) \
|
||||
V(FullGC_RunPhases) \
|
||||
V(PartialGC_RunPhases) \
|
||||
V(STWYoungGC_RunPhases) \
|
||||
V(ConcurrentMarking) \
|
||||
V(ConcurrentMarkingInitialize) \
|
||||
V(IncrementalMarking) \
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "ecmascript/mem/full_gc.h"
|
||||
#include "ecmascript/object_factory-inl.h"
|
||||
#include "ecmascript/mem/concurrent_marker.h"
|
||||
#include "ecmascript/mem/stw_young_gc.h"
|
||||
#include "ecmascript/mem/partial_gc.h"
|
||||
#include "ecmascript/serializer/serialize_chunk.h"
|
||||
#include "ecmascript/tests/ecma_test_common.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "ecmascript/mem/full_gc.h"
|
||||
#include "ecmascript/object_factory-inl.h"
|
||||
#include "ecmascript/mem/concurrent_marker.h"
|
||||
#include "ecmascript/mem/stw_young_gc.h"
|
||||
#include "ecmascript/mem/partial_gc.h"
|
||||
#include "ecmascript/tests/ecma_test_common.h"
|
||||
#include "ecmascript/napi/include/jsnapi_expo.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "ecmascript/mem/full_gc.h"
|
||||
#include "ecmascript/object_factory-inl.h"
|
||||
#include "ecmascript/mem/concurrent_marker.h"
|
||||
#include "ecmascript/mem/stw_young_gc.h"
|
||||
#include "ecmascript/mem/partial_gc.h"
|
||||
#include "ecmascript/tests/ecma_test_common.h"
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "ecmascript/mem/heap-inl.h"
|
||||
#include "ecmascript/tests/test_helper.h"
|
||||
#include "ecmascript/mem/concurrent_marker.h"
|
||||
#include "ecmascript/mem/stw_young_gc.h"
|
||||
#include "ecmascript/mem/partial_gc.h"
|
||||
|
||||
using namespace panda::ecmascript;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "ecmascript/tests/test_helper.h"
|
||||
|
||||
#include "ecmascript/mem/concurrent_marker.h"
|
||||
#include "ecmascript/mem/stw_young_gc.h"
|
||||
#include "ecmascript/mem/partial_gc.h"
|
||||
#include "ecmascript/mem/jit_fort_memdesc.h"
|
||||
#include "ecmascript/mem/jit_fort.h"
|
||||
|
@ -136,6 +136,7 @@ HWTEST_F_L0(MemControllerTest, StartCalculationBeforeGC)
|
||||
|
||||
sleep(1);
|
||||
memController->StartCalculationBeforeGC();
|
||||
memController->CheckLowAllocationUsageState();
|
||||
|
||||
double allocTimeMsAfter = memController->GetAllocTimeMs();
|
||||
size_t oldSpaceSizeAfter = memController->GetOldSpaceAllocAccumulatedSize();
|
||||
|
Loading…
Reference in New Issue
Block a user