!10073 SetProcessingRset 踩内存问题修改

Merge pull request !10073 from jinjiawei/waitsharedgc
This commit is contained in:
openharmony_ci 2024-11-02 21:27:43 +00:00 committed by Gitee
commit 26d41c69b2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 14 additions and 1 deletions

View File

@ -140,6 +140,15 @@ inline void RSetWorkListHandler::MergeBackForAllItem()
}
}
inline void RSetWorkListHandler::NotifyProcessRsetFinished()
{
LockHolder lock(mutex_);
if (!processRsetFinished_) {
heap_->SetProcessingRset(false);
processRsetFinished_ = true;
}
}
inline bool RSetWorkListHandler::MergeBack()
{
ASSERT((JSThread::GetCurrent()->IsJSThread() && JSThread::GetCurrent()->IsInRunningState()) ||

View File

@ -62,6 +62,8 @@ public:
inline void MergeBackForAllItem();
inline void NotifyProcessRsetFinished();
private:
inline void CollectRSetItemsInHeap(const Heap *heap);
@ -83,6 +85,7 @@ private:
* And thus WaitFinishedThenMergeBack should ONLY be called from the bound js thread in RUNNING state.
*/
bool initialized_ {false};
bool processRsetFinished_ {false};
std::vector<RSetItem> items_;
std::atomic<int> nextItemIndex_ {-1};
int remainItems_ {0};

View File

@ -173,7 +173,7 @@ inline void SharedGCMarkerBase::ProcessVisitorOfDoMark(uint32_t threadId)
for (RSetWorkListHandler *handler : rSetHandlers_) {
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "SharedGCMarker::ProcessRSet");
handler->ProcessAll(visitor);
handler->GetHeap()->SetProcessingRset(false);
handler->NotifyProcessRsetFinished();
}
}
@ -220,6 +220,7 @@ inline void SharedGCMarkerBase::ProcessThenMergeBackRSetFromBoundJSThread(RSetWo
ASSERT(JSThread::GetCurrent()->IsInRunningState());
ProcessVisitor(handler);
handler->WaitFinishedThenMergeBack();
handler->NotifyProcessRsetFinished();
}
void SharedGCMovableMarker::MarkObject(uint32_t threadId, TaggedObject *object, ObjectSlot &slot)