From 8133b558e387d25e8ba22a24affcbc934cae02b7 Mon Sep 17 00:00:00 2001 From: Lei Zaakjyu Date: Sat, 23 Dec 2023 10:55:01 +0800 Subject: [PATCH] make 'assert_used_and_recalculate_used_equal' into a member function --- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 4 ++-- src/hotspot/share/gc/g1/g1CollectedHeap.hpp | 2 +- src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp | 6 +++--- src/hotspot/share/gc/g1/g1Policy.cpp | 2 +- src/hotspot/share/gc/g1/g1YoungCollector.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 7a630c27f7963..ab452ac939567 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -761,7 +761,7 @@ void G1CollectedHeap::prepare_heap_for_full_collection() { } void G1CollectedHeap::verify_before_full_collection() { - assert_used_and_recalculate_used_equal(this); + assert_used_and_recalculate_used_equal(); if (!VerifyBeforeGC) { return; } @@ -2845,7 +2845,7 @@ void G1CollectedHeap::rebuild_region_sets(bool free_list_only) { if (!free_list_only) { set_used(cl.total_used()); } - assert_used_and_recalculate_used_equal(this); + assert_used_and_recalculate_used_equal(); } // Methods for the mutator alloc region diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 39ff8bff6d4d2..9f241a7c803a5 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -315,7 +315,7 @@ class G1CollectedHeap : public CollectedHeap { inline static void assert_heap_not_locked() NOT_DEBUG_RETURN; inline static void assert_heap_not_locked_and_not_at_safepoint() NOT_DEBUG_RETURN; inline static void assert_at_safepoint_on_vm_thread() NOT_DEBUG_RETURN; - inline static void assert_used_and_recalculate_used_equal(G1CollectedHeap* g1h) NOT_DEBUG_RETURN; + inline void assert_used_and_recalculate_used_equal() const NOT_DEBUG_RETURN; private: // The young region list. diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index aa0f20d904b7f..b9037c9b8326a 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -361,9 +361,9 @@ inline void G1CollectedHeap::assert_at_safepoint_on_vm_thread() { } inline void G1CollectedHeap:: -assert_used_and_recalculate_used_equal(G1CollectedHeap* g1h) { - size_t cur_used_bytes = g1h->used(); - size_t recal_used_bytes = g1h->recalculate_used(); +assert_used_and_recalculate_used_equal() const { + size_t cur_used_bytes = used(); + size_t recal_used_bytes = recalculate_used(); assert(cur_used_bytes == recal_used_bytes, "Used(" SIZE_FORMAT ") is not" " same as recalculated used(" SIZE_FORMAT ").", cur_used_bytes, recal_used_bytes); diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 68791709c83c3..81cdb29636cee 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -682,7 +682,7 @@ void G1Policy::record_young_collection_start() { assert(max_survivor_regions() + _g1h->num_used_regions() <= _g1h->max_regions(), "Maximum survivor regions %u plus used regions %u exceeds max regions %u", max_survivor_regions(), _g1h->num_used_regions(), _g1h->max_regions()); - G1CollectedHeap::assert_used_and_recalculate_used_equal(_g1h); + G1CollectedHeap::heap()->assert_used_and_recalculate_used_equal(); phase_times()->record_cur_collection_start_sec(now.seconds()); diff --git a/src/hotspot/share/gc/g1/g1YoungCollector.cpp b/src/hotspot/share/gc/g1/g1YoungCollector.cpp index 39b64ec8fe907..b747e3992c7fb 100644 --- a/src/hotspot/share/gc/g1/g1YoungCollector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungCollector.cpp @@ -1012,7 +1012,7 @@ void G1YoungCollector::post_evacuate_collection_set(G1EvacInfo* evacuation_info, _evac_failure_regions.post_collection(); - G1CollectedHeap::assert_used_and_recalculate_used_equal(_g1h); + G1CollectedHeap::heap()->assert_used_and_recalculate_used_equal(); _g1h->rebuild_free_region_list();