!8964 fix gc code check

Merge pull request !8964 from zhou-wenxuan/gc_code_check
This commit is contained in:
openharmony_ci 2024-09-03 03:43:25 +00:00 committed by Gitee
commit 3aac3a4c04
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 16 additions and 3 deletions

View File

@ -16,7 +16,6 @@
#include "ecmascript/mem/free_object_list.h"
#include "ecmascript/free_object.h"
#include "ecmascript/mem/free_object_list.h"
#include "ecmascript/mem/jit_fort.h"
namespace panda::ecmascript {

View File

@ -41,6 +41,8 @@ void GCStats::PrintStatisticResult()
void GCStats::PrintGCStatistic()
{
ASSERT(heap_ != nullptr);
ASSERT(heap_->GetEcmaVM() != nullptr);
if (heap_->GetEcmaVM()->GetJSOptions().EnableGCTracer() || CheckIfLongTimePause()) {
LOG_GC(INFO) << " [ " << GetGCTypeName() << " ] "
<< sizeToMB(recordData_[(uint8_t)RecordData::START_OBJ_SIZE]) << " ("

View File

@ -18,7 +18,6 @@
#include "ecmascript/checkpoint/thread_state_transition.h"
#include "ecmascript/mem/shared_heap/shared_gc_marker-inl.h"
#include "ecmascript/mem/verification.h"
#include "ecmascript/mem/verification.h"
namespace panda::ecmascript {
SharedConcurrentMarker::SharedConcurrentMarker(EnableConcurrentMarkType type)

View File

@ -30,10 +30,13 @@ Space::Space(BaseHeap* heap, HeapRegionAllocator *heapRegionAllocator,
maximumCapacity_(maximumCapacity),
committedSize_(0)
{
ASSERT(heap != nullptr);
ASSERT(heapRegionAllocator != nullptr);
}
void Space::AddAllocationInspector(AllocationInspector* inspector)
{
ASSERT(inspector != nullptr);
allocationCounter_.AddAllocationInspector(inspector);
}
@ -44,6 +47,7 @@ void Space::ClearAllocationInspector()
void Space::SwapAllocationCounter(Space *space)
{
ASSERT(space != nullptr);
std::swap(allocationCounter_, space->allocationCounter_);
}
@ -54,6 +58,7 @@ void Space::Destroy()
void Space::ReclaimRegions(size_t cachedSize)
{
ASSERT(cachedSize >= 0);
EnumerateRegions([this, &cachedSize](Region *current) { ClearAndFreeRegion(current, cachedSize); });
regionList_.Clear();
committedSize_ = 0;
@ -61,6 +66,7 @@ void Space::ReclaimRegions(size_t cachedSize)
void Space::ClearAndFreeRegion(Region *region, size_t cachedSize)
{
ASSERT(region != nullptr);
LOG_ECMA_MEM(DEBUG) << "Clear region from:" << region << " to " << ToSpaceTypeName(spaceType_);
region->DeleteCrossRegionRSet();
region->DeleteNewToEdenRSet();
@ -137,6 +143,8 @@ Region *HugeMachineCodeSpace::AllocateFort(size_t objectSize, JSThread *thread,
// mmap to enable JIT_FORT rights control:
// 1. first mmap (without JIT_FORT option flag) region of size c above
// 2. then mmap immutable area with MAP_FIXED and JIT_FORT option flag (to be used by codesigner verify/copy)
ASSERT(thread != nullptr);
ASSERT(pDesc != nullptr);
MachineCodeDesc *desc = reinterpret_cast<MachineCodeDesc *>(pDesc);
size_t mutableSize = AlignUp(
objectSize + sizeof(Region) + HUGE_OBJECT_BITSET_SIZE - desc->instructionsSize, PageSize());
@ -161,6 +169,8 @@ Region *HugeMachineCodeSpace::AllocateFort(size_t objectSize, JSThread *thread,
uintptr_t HugeMachineCodeSpace::Allocate(size_t objectSize, JSThread *thread, void *pDesc,
AllocateEventType allocType)
{
ASSERT(thread != nullptr);
ASSERT(pDesc != nullptr);
// JitFort path
#if ECMASCRIPT_ENABLE_THREAD_STATE_CHECK
if (UNLIKELY(!thread->IsInRunningStateOrProfiling())) {

View File

@ -22,7 +22,9 @@ namespace panda::ecmascript {
WorkManagerBase::WorkManagerBase(NativeAreaAllocator *allocator)
: spaceChunk_(allocator), workSpace_(0), spaceStart_(0), spaceEnd_(0)
{
workSpace_ = ToUintPtr(GetSpaceChunk()->Allocate(WORKNODE_SPACE_SIZE));
auto allocatedSpace = GetSpaceChunk()->Allocate(WORKNODE_SPACE_SIZE);
ASSERT(allocatedSpace != nullptr);
workSpace_ = ToUintPtr(allocatedSpace);
}
WorkNode *WorkManagerBase::AllocateWorkNode()

View File

@ -22,6 +22,7 @@ WorkSpaceChunk::WorkSpaceChunk(NativeAreaAllocator *allocator) : allocator_(allo
uintptr_t WorkSpaceChunk::NewArea(size_t size)
{
ASSERT(allocator_ != nullptr);
auto area = reinterpret_cast<uintptr_t>(allocator_->AllocateBuffer(size));
if (!area) {
LOG_ECMA_MEM(FATAL) << "OOM WorkSpaceChunk : NewArea area is nullptr";