Delay use new work node

Description:Delay use new work node
Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IB2BGP?from=project-issue

Signed-off-by: dingwen <dingwen6@huawei.com>
Change-Id: I82a3ae822c9a16d87027842589367b92444fa17e
This commit is contained in:
dingwen 2024-11-06 14:51:02 +08:00
parent 281a875bc7
commit 469d2fe4bb
2 changed files with 10 additions and 2 deletions

View File

@ -87,7 +87,9 @@ void WorkManager::PushWorkNodeToGlobal(uint32_t threadId, bool postTask)
WorkNode *&inNode = works_.at(threadId).inNode_;
if (!inNode->IsEmpty()) {
workStack_.Push(inNode);
inNode = AllocateWorkNode();
inNode = works_.at(threadId).cachedInNode_;
ASSERT(inNode != nullptr);
works_.at(threadId).cachedInNode_ = AllocateWorkNode();
if (postTask && heap_->IsParallelGCEnabled() && heap_->CheckCanDistributeTask() &&
!(heap_->IsMarking() && heap_->GetIncrementalMarker()->IsTriggeredIncrementalMark())) {
heap_->PostParallelGCTask(parallelGCTaskPhase_);
@ -162,6 +164,7 @@ void WorkManager::Initialize(TriggerGCType gcType, ParallelGCTaskPhase taskPhase
for (uint32_t i = 0; i < threadNum_; i++) {
WorkNodeHolder &holder = works_.at(i);
holder.inNode_ = AllocateWorkNode();
holder.cachedInNode_ = AllocateWorkNode();
holder.outNode_ = AllocateWorkNode();
holder.weakQueue_ = new ProcessQueue();
holder.weakQueue_->BeginMarking(continuousQueue_.at(i));
@ -204,6 +207,7 @@ void SharedGCWorkManager::Initialize(TriggerGCType gcType, SharedParallelMarkPha
for (uint32_t i = 0; i < threadNum_; i++) {
SharedGCWorkNodeHolder &holder = works_.at(i);
holder.inNode_ = AllocateWorkNode();
holder.cachedInNode_ = AllocateWorkNode();
holder.outNode_ = AllocateWorkNode();
holder.weakQueue_ = new ProcessQueue();
holder.weakQueue_->BeginMarking(continuousQueue_.at(i));
@ -270,7 +274,9 @@ void SharedGCWorkManager::PushWorkNodeToGlobal(uint32_t threadId, bool postTask)
WorkNode *&inNode = works_.at(threadId).inNode_;
if (!inNode->IsEmpty()) {
workStack_.Push(inNode);
inNode = AllocateWorkNode();
inNode = works_.at(threadId).cachedInNode_;
ASSERT(inNode != nullptr);
works_.at(threadId).cachedInNode_ = AllocateWorkNode();
if (postTask && sHeap_->IsParallelGCEnabled() && sHeap_->CheckCanDistributeTask()) {
sHeap_->PostGCMarkingTask(sharedTaskPhase_);
}

View File

@ -133,6 +133,7 @@ private:
struct WorkNodeHolder {
WorkNode *inNode_ {nullptr};
WorkNode *outNode_ {nullptr};
WorkNode *cachedInNode_ {nullptr};
ProcessQueue *weakQueue_ {nullptr};
std::vector<SlotNeedUpdate> pendingUpdateSlots_;
TlabAllocator *allocator_ {nullptr};
@ -264,6 +265,7 @@ private:
struct SharedGCWorkNodeHolder {
WorkNode *inNode_ {nullptr};
WorkNode *cachedInNode_ {nullptr};
WorkNode *outNode_ {nullptr};
ProcessQueue *weakQueue_ {nullptr};
SharedTlabAllocator *allocator_ {nullptr};