Skip to content

Commit

Permalink
make 'assert_used_and_recalculate_used_equal' into a member function
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBing committed Dec 23, 2023
1 parent 75f3010 commit 8133b55
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1CollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1Policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1YoungCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 8133b55

Please sign in to comment.