From d302335088166c7d43b8dca7acfe44c6d4a1bb88 Mon Sep 17 00:00:00 2001 From: Aleksandr Emelenko Date: Mon, 18 Sep 2023 14:48:16 +0300 Subject: [PATCH] Log OBJECT EVENTS Change-Id: Ic093aa74211aa2ce2bba066848f2ea028473efc5 Signed-off-by: Aleksandr Emelenko --- runtime/mem/gc/g1/g1-allocator.cpp | 3 +++ runtime/mem/gc/g1/g1-gc.cpp | 9 +++++++++ runtime/mem/gc/gc.h | 2 +- runtime/mem/heap_verifier.cpp | 3 +++ runtime/mem/region_allocator-inl.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/runtime/mem/gc/g1/g1-allocator.cpp b/runtime/mem/gc/g1/g1-allocator.cpp index 5223a6d83..556efd436 100644 --- a/runtime/mem/gc/g1/g1-allocator.cpp +++ b/runtime/mem/gc/g1/g1-allocator.cpp @@ -365,12 +365,15 @@ void ObjectAllocatorG1::IterateOverObjects(const ObjectVisitor &object_ pygote_space_allocator_->IterateOverObjects(object_visitor); } for (Region *region : object_allocator_->GetAllRegions()) { + LOG(INFO, GC) << "Start iterating over M region " << region; IterateOverObjectsInRegion(region, object_visitor); } for (Region *region : nonmovable_allocator_->GetAllRegions()) { + LOG(INFO, GC) << "Start iterating over NM region " << region; IterateOverObjectsInRegion(region, object_visitor); } for (Region *region : humongous_object_allocator_->GetAllRegions()) { + LOG(INFO, GC) << "Start iterating over H region " << region; IterateOverObjectsInRegion(region, object_visitor); } } diff --git a/runtime/mem/gc/g1/g1-gc.cpp b/runtime/mem/gc/g1/g1-gc.cpp index f1284baa4..b0de94543 100644 --- a/runtime/mem/gc/g1/g1-gc.cpp +++ b/runtime/mem/gc/g1/g1-gc.cpp @@ -413,6 +413,9 @@ void G1GC::CollectEmptyRegions(GCTask &task, PandaVectorGetTiming()); CollectNonRegularObjects(); + for (auto i: *empty_tenured_regions) { + LOG(INFO, GC) << "Clear empty tenured movable region " << i; + } ClearEmptyTenuredMovableRegions(empty_tenured_regions); task.UpdateGCCollectionType(GCCollectionType::TENURED); } @@ -433,6 +436,9 @@ void G1GC::CollectNonRegularObjects() : GCObjectVisitor( NonRegularObjectsDeathChecker(&delete_size, &delete_count)); auto region_visitor = [this](PandaVector ®ions) { + for (auto i : regions) { + LOG(INFO, GC) << "Clear empty non movable region " << i; + } if constexpr (CONCURRENTLY) { update_remset_thread_->InvalidateRegions(®ions); } else { @@ -1226,6 +1232,9 @@ template // NOLINTNEXTLINE(readability-function-size) bool G1GC::CollectAndMove(const CollectionSet &collection_set) { + for (auto i: collection_set) { + LOG(INFO, GC) << "Collect and move region " << i; + } GCScope scope(__FUNCTION__, this, GCPhase::GC_PHASE_COLLECT_YOUNG_AND_MOVE); LOG_DEBUG_GC << "== G1GC CollectAndMove start =="; auto internal_allocator = this->GetInternalAllocator(); diff --git a/runtime/mem/gc/gc.h b/runtime/mem/gc/gc.h index 3c9ca00e9..b97e32fcd 100644 --- a/runtime/mem/gc/gc.h +++ b/runtime/mem/gc/gc.h @@ -82,7 +82,7 @@ namespace panda::mem { // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define LOG_INFO_GC LOG(INFO, GC) << this->GetLogPrefix() // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define LOG_DEBUG_OBJECT_EVENTS LOG(DEBUG, MM_OBJECT_EVENTS) +#define LOG_DEBUG_OBJECT_EVENTS LOG(INFO, GC) // forward declarations: class GCListener; diff --git a/runtime/mem/heap_verifier.cpp b/runtime/mem/heap_verifier.cpp index abade8c8b..0cce68688 100644 --- a/runtime/mem/heap_verifier.cpp +++ b/runtime/mem/heap_verifier.cpp @@ -152,6 +152,9 @@ size_t FastHeapVerifier::VerifyAll() const const std::function lazy_verify_functor(lazy_verify); auto collect_objects = [&](ObjectHeader *object) { heap_objects.insert(object); + if (object == nullptr || object->ClassAddr() == nullptr) { + LOG(INFO, GC) << "Found incorrect object " << object; + } ObjectHelpers::TraverseAllObjects(object, lazy_verify_functor); }; diff --git a/runtime/mem/region_allocator-inl.h b/runtime/mem/region_allocator-inl.h index 0f98d28e9..e4bfdce56 100644 --- a/runtime/mem/region_allocator-inl.h +++ b/runtime/mem/region_allocator-inl.h @@ -83,6 +83,7 @@ Region *RegionAllocatorBase::CreateAndSetUpNewRegion(size_t region_ if (region_type == RegionFlag::IS_EDEN) { AllocConfigT::OnInitYoungRegion({region->Begin(), region->End()}); } + LOG(INFO, GC) << "Allocate new region " << region; // Do memory barrier here to make sure all threads see references to bitmaps. // The situation: // A mutator thread allocates a new object. During object allocation the mutator -- Gitee