--- old/src/hotspot/share/gc/g1/g1CollectionSet.cpp 2019-01-23 10:43:53.632618513 +0100 +++ new/src/hotspot/share/gc/g1/g1CollectionSet.cpp 2019-01-23 10:43:53.143603134 +0100 @@ -44,10 +44,6 @@ 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()); } @@ -55,7 +51,7 @@ 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), @@ -80,7 +76,7 @@ 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, @@ -439,14 +435,14 @@ } 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); } @@ -480,7 +476,7 @@ 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(); @@ -490,7 +486,7 @@ "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. @@ -502,7 +498,7 @@ // 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) { @@ -551,13 +547,13 @@ 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(); @@ -630,15 +626,15 @@ 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(); }