sendable env bugfix and enable force shared full gc

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAIBF4?from=project-issue

Signed-off-by: xiongluo <xiongluo@huawei.com>
Change-Id: Idf516f7899b32dc4052e5db9e41dfc56a2bb4106
This commit is contained in:
xiongluo 2024-08-07 00:12:22 +08:00
parent 66e00557a1
commit 37dfde9f3f
5 changed files with 11 additions and 10 deletions

View File

@ -195,7 +195,8 @@ JSTaggedValue BuiltinsArkTools::ForceFullGC(EcmaRuntimeCallInfo *info)
auto heap = const_cast<Heap *>(info->GetThread()->GetEcmaVM()->GetHeap());
heap->CollectGarbage(
TriggerGCType::FULL_GC, GCReason::EXTERNAL_TRIGGER);
SharedHeap::GetInstance()->CollectGarbage<TriggerGCType::SHARED_GC, GCReason::EXTERNAL_TRIGGER>(info->GetThread());
SharedHeap::GetInstance()->CollectGarbage<TriggerGCType::SHARED_FULL_GC, GCReason::EXTERNAL_TRIGGER>(
info->GetThread());
heap->GetHeapPrepare();
return JSTaggedValue::True();
}

View File

@ -1122,9 +1122,9 @@ JSTaggedValue JSFunction::GetNativeFunctionExtraInfo() const
void JSFunction::InitializeForConcurrentFunction(JSThread *thread, JSHandle<JSFunction> &func)
{
JSHandle<Method> method(thread, func->GetMethod());
JSTaggedValue sendableEnv = JSTaggedValue::Undefined();
JSMutableHandle<JSTaggedValue> sendableEnv(thread, JSTaggedValue::Undefined());
if (!func->GetModule().IsUndefined()) {
sendableEnv = SourceTextModule::Cast(func->GetModule())->GetSendableEnv();
sendableEnv.Update(SourceTextModule::Cast(func->GetModule())->GetSendableEnv());
}
const JSPandaFile *jsPandaFile = method->GetJSPandaFile();
if (jsPandaFile == nullptr) {

View File

@ -74,7 +74,7 @@ void SharedFullGC::Mark()
TRACE_GC(GCStats::Scope::ScopeId::Mark, sHeap_->GetEcmaGCStats());
SharedGCMovableMarker *marker = sHeap_->GetSharedGCMovableMarker();
marker->MarkRoots(DAEMON_THREAD_INDEX, SharedMarkType::NOT_CONCURRENT_MARK);
marker->MarkRoots(DAEMON_THREAD_INDEX, SharedMarkType::NOT_CONCURRENT_MARK, VMRootVisitType::UPDATE_ROOT);
marker->DoMark<SharedMarkType::NOT_CONCURRENT_MARK>(DAEMON_THREAD_INDEX);
marker->MergeBackAndResetRSetWorkListHandler();
sHeap_->WaitRunningTaskFinished();

View File

@ -22,7 +22,7 @@
#include "ecmascript/runtime.h"
namespace panda::ecmascript {
void SharedGCMarkerBase::MarkRoots(uint32_t threadId, SharedMarkType markType)
void SharedGCMarkerBase::MarkRoots(uint32_t threadId, SharedMarkType markType, VMRootVisitType type)
{
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "SharedGCMarkerBase::MarkRoots");
MarkSerializeRoots(threadId);
@ -38,14 +38,14 @@ void SharedGCMarkerBase::MarkRoots(uint32_t threadId, SharedMarkType markType)
runtime->GCIterateThreadList([&](JSThread *thread) {
ASSERT(!thread->IsInRunningState());
auto vm = thread->GetEcmaVM();
MarkLocalVMRoots(threadId, vm);
MarkLocalVMRoots(threadId, vm, type);
if (markType != SharedMarkType::CONCURRENT_MARK_REMARK) {
CollectLocalVMRSet(vm);
}
});
}
void SharedGCMarkerBase::MarkLocalVMRoots(uint32_t threadId, EcmaVM *localVm)
void SharedGCMarkerBase::MarkLocalVMRoots(uint32_t threadId, EcmaVM *localVm, VMRootVisitType type)
{
ECMA_BYTRACE_NAME(HITRACE_TAG_ARK, "SharedGCMarkerBase::MarkLocalVMRoots");
Heap *heap = const_cast<Heap*>(localVm->GetHeap());
@ -59,7 +59,7 @@ void SharedGCMarkerBase::MarkLocalVMRoots(uint32_t threadId, EcmaVM *localVm)
},
[this](Root type, ObjectSlot base, ObjectSlot derived, uintptr_t baseOldObject) {
this->HandleLocalDerivedRoots(type, base, derived, baseOldObject);
}, VMRootVisitType::MARK);
}, type);
heap->ProcessSharedGCMarkingLocalBuffer();
}

View File

@ -40,8 +40,8 @@ public:
virtual ~SharedGCMarkerBase() = default;
void ResetWorkManager(SharedGCWorkManager *workManager);
void MarkRoots(uint32_t threadId, SharedMarkType markType);
void MarkLocalVMRoots(uint32_t threadId, EcmaVM *localVm);
void MarkRoots(uint32_t threadId, SharedMarkType markType, VMRootVisitType type = VMRootVisitType::MARK);
void MarkLocalVMRoots(uint32_t threadId, EcmaVM *localVm, VMRootVisitType type = VMRootVisitType::MARK);
void CollectLocalVMRSet(EcmaVM *localVm);
void MarkStringCache(uint32_t threadId);
void MarkSerializeRoots(uint32_t threadId);