< prev index next >
src/hotspot/share/gc/g1/g1CollectionSet.cpp
Print this page
rev 49524 : imported patch 8200426-g1h-refactoring
*** 33,43 ****
#include "logging/logStream.hpp"
#include "utilities/debug.hpp"
#include "utilities/quickSort.hpp"
G1CollectorState* G1CollectionSet::collector_state() {
! return _g1->collector_state();
}
G1GCPhaseTimes* G1CollectionSet::phase_times() {
return _policy->phase_times();
}
--- 33,43 ----
#include "logging/logStream.hpp"
#include "utilities/debug.hpp"
#include "utilities/quickSort.hpp"
G1CollectorState* G1CollectionSet::collector_state() {
! return _g1h->collector_state();
}
G1GCPhaseTimes* G1CollectionSet::phase_times() {
return _policy->phase_times();
}
*** 49,59 ****
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) :
! _g1(g1h),
_policy(policy),
_cset_chooser(new CollectionSetChooser()),
_eden_region_length(0),
_survivor_region_length(0),
_old_region_length(0),
--- 49,59 ----
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()),
_eden_region_length(0),
_survivor_region_length(0),
_old_region_length(0),
*** 107,117 ****
assert(_inc_build_state == Active, "Precondition");
assert(hr->is_old(), "the region should be old");
assert(!hr->in_collection_set(), "should not already be in the CSet");
! _g1->register_old_region_with_cset(hr);
_collection_set_regions[_collection_set_cur_length++] = hr->hrm_index();
assert(_collection_set_cur_length <= _collection_set_max_length, "Collection set now larger than maximum size.");
_bytes_used_before += hr->used();
--- 107,117 ----
assert(_inc_build_state == Active, "Precondition");
assert(hr->is_old(), "the region should be old");
assert(!hr->in_collection_set(), "should not already be in the CSet");
! _g1h->register_old_region_with_cset(hr);
_collection_set_regions[_collection_set_cur_length++] = hr->hrm_index();
assert(_collection_set_cur_length <= _collection_set_max_length, "Collection set now larger than maximum size.");
_bytes_used_before += hr->used();
*** 183,193 ****
}
size_t start_pos = (worker_id * len) / total_workers;
size_t cur_pos = start_pos;
do {
! HeapRegion* r = G1CollectedHeap::heap()->region_at(_collection_set_regions[cur_pos]);
bool result = cl->do_heap_region(r);
if (result) {
cl->set_incomplete();
return;
}
--- 183,193 ----
}
size_t start_pos = (worker_id * len) / total_workers;
size_t cur_pos = start_pos;
do {
! HeapRegion* r = _g1h->region_at(_collection_set_regions[cur_pos]);
bool result = cl->do_heap_region(r);
if (result) {
cl->set_incomplete();
return;
}
*** 255,265 ****
// are calculated, aggregated with the policy collection set info,
// and cached in the heap region here (initially) and (subsequently)
// by the Young List sampling code.
// Ignore calls to this due to retirement during full gc.
! if (!G1CollectedHeap::heap()->collector_state()->in_full_gc()) {
size_t rs_length = hr->rem_set()->occupied();
double region_elapsed_time_ms = predict_region_elapsed_time_ms(hr);
// Cache the values we have added to the aggregated information
// in the heap region in case we have to remove this region from
--- 255,265 ----
// are calculated, aggregated with the policy collection set info,
// and cached in the heap region here (initially) and (subsequently)
// by the Young List sampling code.
// Ignore calls to this due to retirement during full gc.
! if (!_g1h->collector_state()->in_full_gc()) {
size_t rs_length = hr->rem_set()->occupied();
double region_elapsed_time_ms = predict_region_elapsed_time_ms(hr);
// Cache the values we have added to the aggregated information
// in the heap region in case we have to remove this region from
*** 272,282 ****
_inc_predicted_elapsed_time_ms += region_elapsed_time_ms;
_inc_bytes_used_before += hr->used();
}
assert(!hr->in_collection_set(), "invariant");
! _g1->register_young_region_with_cset(hr);
}
void G1CollectionSet::add_survivor_regions(HeapRegion* hr) {
assert(hr->is_survivor(), "Must only add survivor regions, but is %s", hr->get_type_str());
add_young_region_common(hr);
--- 272,282 ----
_inc_predicted_elapsed_time_ms += region_elapsed_time_ms;
_inc_bytes_used_before += hr->used();
}
assert(!hr->in_collection_set(), "invariant");
! _g1h->register_young_region_with_cset(hr);
}
void G1CollectionSet::add_survivor_regions(HeapRegion* hr) {
assert(hr->is_survivor(), "Must only add survivor regions, but is %s", hr->get_type_str());
add_young_region_common(hr);
*** 371,381 ****
// The young list is laid with the survivor regions from the previous
// pause are appended to the RHS of the young list, i.e.
// [Newly Young Regions ++ Survivors from last pause].
uint survivor_region_length = survivors->length();
! uint eden_region_length = _g1->eden_regions_count();
init_region_lengths(eden_region_length, survivor_region_length);
verify_young_cset_indices();
// Clear the fields that point to the survivor list - they are all young now.
--- 371,381 ----
// The young list is laid with the survivor regions from the previous
// pause are appended to the RHS of the young list, i.e.
// [Newly Young Regions ++ Survivors from last pause].
uint survivor_region_length = survivors->length();
! uint eden_region_length = _g1h->eden_regions_count();
init_region_lengths(eden_region_length, survivor_region_length);
verify_young_cset_indices();
// Clear the fields that point to the survivor list - they are all young now.
*** 474,484 ****
// We will add this region to the CSet.
time_remaining_ms = MAX2(time_remaining_ms - predicted_time_ms, 0.0);
predicted_old_time_ms += predicted_time_ms;
cset_chooser()->pop(); // already have region via peek()
! _g1->old_set_remove(hr);
add_old_region(hr);
hr = cset_chooser()->peek();
}
if (hr == NULL) {
--- 474,484 ----
// We will add this region to the CSet.
time_remaining_ms = MAX2(time_remaining_ms - predicted_time_ms, 0.0);
predicted_old_time_ms += predicted_time_ms;
cset_chooser()->pop(); // already have region via peek()
! _g1h->old_set_remove(hr);
add_old_region(hr);
hr = cset_chooser()->peek();
}
if (hr == NULL) {
< prev index next >