8264027: Refactor "CLEANUP" region printing
Reviewed-by: kbarrett, ayang
This commit is contained in:
parent
eb6330e4f0
commit
bf26a2558f
@ -4031,7 +4031,6 @@ void G1CollectedHeap::free_region(HeapRegion* hr, FreeRegionList* free_list) {
|
||||
void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
|
||||
FreeRegionList* free_list) {
|
||||
assert(hr->is_humongous(), "this is only for humongous regions");
|
||||
assert(free_list != NULL, "pre-condition");
|
||||
hr->clear_humongous();
|
||||
free_region(hr, free_list);
|
||||
}
|
||||
@ -4183,6 +4182,7 @@ class G1FreeCollectionSetTask : public AbstractGangTask {
|
||||
|
||||
// Free the region and and its remembered set.
|
||||
_g1h->free_region(r, NULL);
|
||||
_g1h->hr_printer()->cleanup(r);
|
||||
}
|
||||
|
||||
void handle_failed_region(HeapRegion* r) {
|
||||
@ -4336,16 +4336,14 @@ void G1CollectedHeap::free_collection_set(G1CollectionSet* collection_set, G1Eva
|
||||
}
|
||||
|
||||
class G1FreeHumongousRegionClosure : public HeapRegionClosure {
|
||||
private:
|
||||
FreeRegionList* _free_region_list;
|
||||
HeapRegionSet* _proxy_set;
|
||||
uint _humongous_objects_reclaimed;
|
||||
uint _humongous_regions_reclaimed;
|
||||
size_t _freed_bytes;
|
||||
public:
|
||||
|
||||
G1FreeHumongousRegionClosure(FreeRegionList* free_region_list) :
|
||||
_free_region_list(free_region_list), _proxy_set(NULL), _humongous_objects_reclaimed(0), _humongous_regions_reclaimed(0), _freed_bytes(0) {
|
||||
G1FreeHumongousRegionClosure() :
|
||||
_proxy_set(NULL), _humongous_objects_reclaimed(0), _humongous_regions_reclaimed(0), _freed_bytes(0) {
|
||||
}
|
||||
|
||||
virtual bool do_heap_region(HeapRegion* r) {
|
||||
@ -4430,7 +4428,8 @@ public:
|
||||
_freed_bytes += r->used();
|
||||
r->set_containing_set(NULL);
|
||||
_humongous_regions_reclaimed++;
|
||||
g1h->free_humongous_region(r, _free_region_list);
|
||||
g1h->free_humongous_region(r, NULL);
|
||||
g1h->hr_printer()->cleanup(r);
|
||||
r = next;
|
||||
} while (r != NULL);
|
||||
|
||||
@ -4461,22 +4460,11 @@ void G1CollectedHeap::eagerly_reclaim_humongous_regions() {
|
||||
|
||||
double start_time = os::elapsedTime();
|
||||
|
||||
FreeRegionList local_cleanup_list("Local Humongous Cleanup List");
|
||||
|
||||
G1FreeHumongousRegionClosure cl(&local_cleanup_list);
|
||||
G1FreeHumongousRegionClosure cl;
|
||||
heap_region_iterate(&cl);
|
||||
|
||||
remove_from_old_gen_sets(0, 0, cl.humongous_regions_reclaimed());
|
||||
|
||||
G1HRPrinter* hrp = hr_printer();
|
||||
if (hrp->is_active()) {
|
||||
FreeRegionListIterator iter(&local_cleanup_list);
|
||||
while (iter.more_available()) {
|
||||
HeapRegion* hr = iter.get_next();
|
||||
hrp->cleanup(hr);
|
||||
}
|
||||
}
|
||||
|
||||
decrement_summary_bytes(cl.bytes_freed());
|
||||
|
||||
phase_times()->record_fast_reclaim_humongous_time_ms((os::elapsedTime() - start_time) * 1000.0,
|
||||
|
@ -1288,14 +1288,7 @@ void G1ConcurrentMark::reclaim_empty_regions() {
|
||||
if (!empty_regions_list.is_empty()) {
|
||||
log_debug(gc)("Reclaimed %u empty regions", empty_regions_list.length());
|
||||
// Now print the empty regions list.
|
||||
G1HRPrinter* hrp = _g1h->hr_printer();
|
||||
if (hrp->is_active()) {
|
||||
FreeRegionListIterator iter(&empty_regions_list);
|
||||
while (iter.more_available()) {
|
||||
HeapRegion* hr = iter.get_next();
|
||||
hrp->cleanup(hr);
|
||||
}
|
||||
}
|
||||
_g1h->hr_printer()->cleanup(&empty_regions_list);
|
||||
// And actually make them available.
|
||||
_g1h->prepend_to_freelist(&empty_regions_list);
|
||||
}
|
||||
|
38
src/hotspot/share/gc/g1/g1HRPrinter.cpp
Normal file
38
src/hotspot/share/gc/g1/g1HRPrinter.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
|
||||
#include "gc/g1/g1HRPrinter.hpp"
|
||||
#include "gc/g1/heapRegionSet.hpp"
|
||||
|
||||
void G1HRPrinter::cleanup(FreeRegionList* cleanup_list) {
|
||||
if (is_active()) {
|
||||
FreeRegionListIterator iter(cleanup_list);
|
||||
while (iter.more_available()) {
|
||||
HeapRegion* hr = iter.get_next();
|
||||
cleanup(hr);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,8 @@
|
||||
|
||||
#define SKIP_RETIRED_FULL_REGIONS 1
|
||||
|
||||
class FreeRegionList;
|
||||
|
||||
class G1HRPrinter {
|
||||
|
||||
private:
|
||||
@ -86,6 +88,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void cleanup(FreeRegionList* free_list);
|
||||
|
||||
void post_compaction(HeapRegion* hr) {
|
||||
if (is_active()) {
|
||||
print("POST-COMPACTION", hr);
|
||||
|
Loading…
Reference in New Issue
Block a user