!9996 fix local gc wait shared gc processRset

Merge pull request !9996 from jinjiawei/waitsharedgc
This commit is contained in:
openharmony_ci 2024-10-27 15:55:04 +00:00 committed by Gitee
commit 999f1a121e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 18 additions and 0 deletions

View File

@ -800,6 +800,11 @@ bool JSThread::CheckSafepoint()
}
#endif
auto heap = const_cast<Heap *>(GetEcmaVM()->GetHeap());
// Do not trigger local gc during the shared gc processRset process.
if (heap->IsProcessingRset()) {
return false;
}
// Handle exit app senstive scene
heap->HandleExitHighSensitiveEvent();

View File

@ -1516,6 +1516,16 @@ public:
return gcType_ == TriggerGCType::YOUNG_GC || gcType_ == TriggerGCType::EDEN_GC;
}
bool IsProcessingRset() const
{
return isProcessingRset_;
}
void SetProcessingRset(bool processing)
{
isProcessingRset_ = processing;
}
void EnableEdenGC();
void TryEnableEdenGC();
@ -1739,6 +1749,7 @@ private:
bool fullMarkRequested_ {false};
bool oldSpaceLimitAdjusted_ {false};
bool enableIdleGC_ {false};
bool isProcessingRset_ {false};
std::atomic_bool isCSetClearing_ {false};
HeapMode mode_ { HeapMode::NORMAL };

View File

@ -173,6 +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);
}
}

View File

@ -68,6 +68,7 @@ void SharedGCMarkerBase::CollectLocalVMRSet(EcmaVM *localVm)
Heap *heap = const_cast<Heap*>(localVm->GetHeap());
RSetWorkListHandler *handler = new RSetWorkListHandler(heap);
heap->SetRSetWorkListHandler(handler);
heap->SetProcessingRset(true);
rSetHandlers_.emplace_back(handler);
}