< prev index next >

src/hotspot/share/gc/g1/g1CollectionSet.cpp

Print this page
rev 57223 : imported patch 8225484-changes-to-survivor-calculation

*** 64,73 **** --- 64,74 ---- _num_optional_regions(0), _bytes_used_before(0), _recorded_rs_length(0), _inc_build_state(Inactive), _inc_part_start(0), + _cur_eden_young_idx(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),
*** 160,169 **** --- 161,171 ---- _inc_recorded_rs_length_diff = 0; _inc_predicted_non_copy_time_ms = 0.0; _inc_predicted_non_copy_time_ms_diff = 0.0; update_incremental_marker(); + _cur_eden_young_idx = 0; } void G1CollectionSet::finalize_incremental_building() { assert(_inc_build_state == Active, "Precondition"); assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint");
*** 304,318 **** } assert(!hr->in_collection_set(), "invariant"); _g1h->register_young_region_with_region_attr(hr); - // We use UINT_MAX as "invalid" marker in verification. - 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_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++; --- 306,315 ----
*** 320,333 **** --- 317,338 ---- } 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); + _survivor_region_length++; } void G1CollectionSet::add_eden_region(HeapRegion* hr) { assert(hr->is_eden(), "Must only add eden regions, but is %s", hr->get_type_str()); + assert(_collection_set_cur_length <= INT_MAX, "Collection set is too large with %d entries", (int)_collection_set_cur_length); + + // Young index for eden regions should start at 1. 0 is reserved for other region types. + uint next_eden_young_idx = ++_cur_eden_young_idx; + assert(next_eden_young_idx > 0, "Invalid next young region idx %d", next_eden_young_idx); + hr->set_young_index_in_cset(next_eden_young_idx); + add_young_region_common(hr); } #ifndef PRODUCT class G1VerifyYoungAgesClosure : public HeapRegionClosure {
*** 337,353 **** G1VerifyYoungAgesClosure() : HeapRegionClosure(), _valid(true) { } virtual bool do_heap_region(HeapRegion* r) { guarantee(r->is_young(), "Region must be young but is %s", r->get_type_str()); if (!r->has_surv_rate_group()) { ! log_error(gc, verify)("## encountered young region without surv_rate_group"); _valid = false; } if (!r->has_valid_age_in_surv_rate()) { ! log_error(gc, verify)("## encountered invalid age in young region"); _valid = false; } return false; } --- 342,364 ---- G1VerifyYoungAgesClosure() : HeapRegionClosure(), _valid(true) { } virtual bool do_heap_region(HeapRegion* r) { guarantee(r->is_young(), "Region must be young but is %s", r->get_type_str()); + if (r->is_survivor()) { + assert(r->survivor_bytes() > 0, "## encountered survivor region without contents"); + assert(!r->has_surv_rate_group(), "## encountered surv_rate_group in survivor region"); + return false; + } + if (!r->has_surv_rate_group()) { ! log_error(gc, verify)("## encountered eden region without surv_rate_group"); _valid = false; } if (!r->has_valid_age_in_surv_rate()) { ! log_error(gc, verify)("## encountered invalid age in eden region"); _valid = false; } return false; }
*** 557,574 **** } virtual bool do_heap_region(HeapRegion* r) { const uint idx = r->young_index_in_cset(); ! assert(idx > 0, "Young index must be set for all regions in the incremental collection set but is not for region %u.", r->hrm_index()); ! assert(idx <= _young_length, "Young cset index %u too large for region %u", idx, r->hrm_index()); assert(_heap_region_indices[idx] == UINT_MAX, "Index %d used by multiple regions, first use by region %u, second by region %u", idx, _heap_region_indices[idx], r->hrm_index()); - _heap_region_indices[idx] = r->hrm_index(); return false; } }; --- 568,588 ---- } virtual bool do_heap_region(HeapRegion* r) { const uint idx = r->young_index_in_cset(); ! assert(idx > 0 || r->survivor_bytes() > 0, ! "Young index must be set for all regions not having survivor bytes but region %u.", ! r->hrm_index()); ! assert(idx == 0 || idx <= _young_length, "Young cset index %u too large for region %u", idx, r->hrm_index()); + if (idx != 0) { assert(_heap_region_indices[idx] == UINT_MAX, "Index %d used by multiple regions, first use by region %u, second by region %u", idx, _heap_region_indices[idx], r->hrm_index()); _heap_region_indices[idx] = r->hrm_index(); + } return false; } };
< prev index next >