< prev index next >
src/hotspot/share/gc/g1/g1CollectionSet.cpp
Print this page
rev 57061 : imported patch 8227739-merge-scan-rs-update-rs-cost
rev 57064 : imported patch 8233998-new-young-regions-registered-too-early
rev 57065 : imported patch 8233919-incrementally-calc-num-occupied
rev 57067 : imported patch 8233588-cleanup-survrategroup
rev 57068 : imported patch 8233588-kbarrett-review
rev 57069 : imported patch 8231579-incremental-calculation-wrong
rev 57070 : imported patch 8231579-sjohanss-review
rev 57072 : imported patch 8234179-move-heapregion-inc-cset-stats-into-g1collectionset
@@ -63,19 +63,21 @@
_num_optional_regions(0),
_bytes_used_before(0),
_recorded_rs_length(0),
_inc_build_state(Inactive),
_inc_part_start(0),
+ _inc_collection_set_stats(NULL),
_inc_bytes_used_before(0),
_inc_recorded_rs_length(0),
_inc_recorded_rs_length_diff(0),
_inc_predicted_non_copy_time_ms(0.0),
_inc_predicted_non_copy_time_ms_diff(0.0) {
}
G1CollectionSet::~G1CollectionSet() {
FREE_C_HEAP_ARRAY(uint, _collection_set_regions);
+ FREE_C_HEAP_ARRAY(IncCollectionSetRegionStat, _inc_collection_set_stats);
free_optional_regions();
clear_candidates();
}
void G1CollectionSet::init_region_lengths(uint eden_cset_region_length,
@@ -94,10 +96,11 @@
void G1CollectionSet::initialize(uint max_region_length) {
guarantee(_collection_set_regions == NULL, "Must only initialize once.");
_collection_set_max_length = max_region_length;
_collection_set_regions = NEW_C_HEAP_ARRAY(uint, max_region_length, mtGC);
+ _inc_collection_set_stats = NEW_C_HEAP_ARRAY(IncCollectionSetRegionStat, max_region_length, mtGC);
}
void G1CollectionSet::free_optional_regions() {
_num_optional_regions = 0;
}
@@ -235,22 +238,25 @@
size_t new_rs_length) {
// Update the CSet information that is dependent on the new RS length
assert(hr->is_young(), "Precondition");
assert(!SafepointSynchronize::is_at_safepoint(), "should not be at a safepoint");
- size_t old_rs_length = hr->recorded_rs_length();
+ IncCollectionSetRegionStat* stat = &_inc_collection_set_stats[hr->hrm_index()];
+
+ size_t old_rs_length = stat->_rs_length;
assert(old_rs_length <= new_rs_length,
"Remembered set sizes must increase (changed from " SIZE_FORMAT " to " SIZE_FORMAT " region %u type %s)",
old_rs_length, new_rs_length, hr->hrm_index(), hr->get_short_type_str());
size_t rs_length_diff = new_rs_length - old_rs_length;
- hr->set_recorded_rs_length(new_rs_length);
+ stat->_rs_length = new_rs_length;
_inc_recorded_rs_length_diff += rs_length_diff;
- double old_non_copy_time = hr->predicted_non_copy_time_ms();
+ double old_non_copy_time = stat->_non_copy_time_ms;
double new_non_copy_time = predict_region_non_copy_time_ms(hr);
double non_copy_time_ms_diff = new_non_copy_time - old_non_copy_time;
- hr->set_predicted_non_copy_time_ms(new_non_copy_time);
+
+ stat->_non_copy_time_ms = new_non_copy_time;
_inc_predicted_non_copy_time_ms_diff += non_copy_time_ms_diff;
}
void G1CollectionSet::add_young_region_common(HeapRegion* hr) {
assert(hr->is_young(), "invariant");
@@ -272,34 +278,35 @@
// 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_non_copy_time = predict_region_non_copy_time_ms(hr);
+ double non_copy_time = predict_region_non_copy_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
// the incremental collection set, or it is updated by the
// rset sampling code
- hr->set_recorded_rs_length(rs_length);
- hr->set_predicted_non_copy_time_ms(region_non_copy_time);
+
+ IncCollectionSetRegionStat* stat = &_inc_collection_set_stats[hr->hrm_index()];
+ stat->_rs_length = rs_length;
+ stat->_non_copy_time_ms = non_copy_time;
_inc_recorded_rs_length += rs_length;
- _inc_predicted_non_copy_time_ms += region_non_copy_time;
+ _inc_predicted_non_copy_time_ms += non_copy_time;
_inc_bytes_used_before += hr->used();
}
assert(!hr->in_collection_set(), "invariant");
_g1h->register_young_region_with_region_attr(hr);
- size_t collection_set_length = _collection_set_cur_length;
// We use UINT_MAX as "invalid" marker in verification.
- assert(collection_set_length < (UINT_MAX - 1),
- "Collection set is too large with " SIZE_FORMAT " entries", collection_set_length);
- hr->set_young_index_in_cset((uint)collection_set_length + 1);
+ assert(_collection_set_cur_length < (UINT_MAX - 1),
+ "Collection set is too large with " SIZE_FORMAT " entries", _collection_set_cur_length);
+ hr->set_young_index_in_cset((uint)_collection_set_cur_length + 1);
- _collection_set_regions[collection_set_length] = hr->hrm_index();
+ _collection_set_regions[_collection_set_cur_length] = hr->hrm_index();
// Concurrent readers must observe the store of the value in the array before an
// update to the length field.
OrderAccess::storestore();
_collection_set_cur_length++;
assert(_collection_set_cur_length <= _collection_set_max_length, "Collection set larger than maximum allowed.");
< prev index next >