< prev index next >
src/hotspot/share/gc/g1/g1CollectionSet.cpp
Print this page
rev 53416 : imported patch 8217330-split-collectionsetchooser
rev 53417 : [mq]: 8217330-leo-review
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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.
@@ -42,22 +42,18 @@
G1GCPhaseTimes* G1CollectionSet::phase_times() {
return _policy->phase_times();
}
-CollectionSetChooser* G1CollectionSet::cset_chooser() {
- return _cset_chooser;
-}
-
double G1CollectionSet::predict_region_elapsed_time_ms(HeapRegion* hr) {
return _policy->predict_region_elapsed_time_ms(hr, collector_state()->in_young_only_phase());
}
G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) :
_g1h(g1h),
_policy(policy),
- _cset_chooser(new CollectionSetChooser()),
+ _candidates(NULL),
_eden_region_length(0),
_survivor_region_length(0),
_old_region_length(0),
_collection_set_regions(NULL),
_collection_set_cur_length(0),
@@ -78,11 +74,11 @@
G1CollectionSet::~G1CollectionSet() {
if (_collection_set_regions != NULL) {
FREE_C_HEAP_ARRAY(uint, _collection_set_regions);
}
free_optional_regions();
- delete _cset_chooser;
+ clear_candidates();
}
void G1CollectionSet::init_region_lengths(uint eden_cset_region_length,
uint survivor_cset_region_length) {
assert_at_safepoint_on_vm_thread();
@@ -437,18 +433,18 @@
return time_remaining_ms;
}
void G1CollectionSet::add_as_old(HeapRegion* hr) {
- cset_chooser()->pop(); // already have region via peek()
+ candidates()->pop_front(); // already have region via peek()
_g1h->old_set_remove(hr);
add_old_region(hr);
}
void G1CollectionSet::add_as_optional(HeapRegion* hr) {
assert(_optional_regions != NULL, "Must not be called before array is allocated");
- cset_chooser()->pop(); // already have region via peek()
+ candidates()->pop_front(); // already have region via peek()
_g1h->old_set_remove(hr);
add_optional_region(hr);
}
bool G1CollectionSet::optional_is_full() {
@@ -478,21 +474,21 @@
double predicted_optional_time_ms = 0.0;
double optional_threshold_ms = time_remaining_ms * _policy->optional_prediction_fraction();
uint expensive_region_num = 0;
if (collector_state()->in_mixed_phase()) {
- cset_chooser()->verify();
+ candidates()->verify();
const uint min_old_cset_length = _policy->calc_min_old_cset_length();
const uint max_old_cset_length = MAX2(min_old_cset_length, _policy->calc_max_old_cset_length());
bool check_time_remaining = _policy->adaptive_young_list_length();
initialize_optional(max_old_cset_length - min_old_cset_length);
log_debug(gc, ergo, cset)("Start adding old regions for mixed gc. min %u regions, max %u regions, "
"time remaining %1.2fms, optional threshold %1.2fms",
min_old_cset_length, max_old_cset_length, time_remaining_ms, optional_threshold_ms);
- HeapRegion* hr = cset_chooser()->peek();
+ HeapRegion* hr = candidates()->peek_front();
while (hr != NULL) {
if (old_region_length() + optional_region_length() >= max_old_cset_length) {
// Added maximum number of old regions to the CSet.
log_debug(gc, ergo, cset)("Finish adding old regions to CSet (old CSet region num reached max). "
"old %u regions, optional %u regions",
@@ -500,11 +496,11 @@
break;
}
// Stop adding regions if the remaining reclaimable space is
// not above G1HeapWastePercent.
- size_t reclaimable_bytes = cset_chooser()->remaining_reclaimable_bytes();
+ size_t reclaimable_bytes = candidates()->remaining_reclaimable_bytes();
double reclaimable_percent = _policy->reclaimable_bytes_percent(reclaimable_bytes);
double threshold = (double) G1HeapWastePercent;
if (reclaimable_percent <= threshold) {
// We've added enough old regions that the amount of uncollected
// reclaimable space is at or below the waste threshold. Stop
@@ -549,17 +545,17 @@
} else {
log_debug(gc, ergo, cset)("Finish adding old regions to CSet (predicted time is too high).");
break;
}
}
- hr = cset_chooser()->peek();
+ hr = candidates()->peek_front();
}
if (hr == NULL) {
log_debug(gc, ergo, cset)("Finish adding old regions to CSet (candidate old regions not available)");
}
- cset_chooser()->verify();
+ candidates()->verify();
}
stop_incremental_building();
log_debug(gc, ergo, cset)("Finish choosing CSet regions old: %u, optional: %u, "
@@ -628,19 +624,19 @@
}
G1OptionalCSet::~G1OptionalCSet() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
while (!is_empty()) {
- // We want to return regions not evacuated to the
- // chooser in reverse order to maintain the old order.
+ // We want to return regions not evacuated to the collection set candidates
+ // in reverse order to maintain the old order.
HeapRegion* hr = _cset->remove_last_optional_region();
assert(hr != NULL, "Should be valid region left");
_pset->record_unused_optional_region(hr);
g1h->old_set_add(hr);
g1h->clear_in_cset(hr);
hr->set_index_in_opt_cset(InvalidCSetIndex);
- _cset->cset_chooser()->push(hr);
+ _cset->candidates()->push_front(hr);
}
_cset->free_optional_regions();
}
uint G1OptionalCSet::size() {
< prev index next >