8242227: Shenandoah: transit regions to cset state when adding to collection set

Reviewed-by: rkennke
This commit is contained in:
Aleksey Shipilev 2020-04-06 20:35:36 +02:00
parent dc57693c28
commit c6b63ee3c3
3 changed files with 3 additions and 17 deletions

View File

@ -87,6 +87,9 @@ void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) {
_garbage += r->garbage();
_live_data += r->get_live_data_bytes();
_used += r->used();
// Update the region status too. State transition would be checked internally.
r->make_cset();
}
bool ShenandoahCollectionSet::add_region_check_for_duplicates(ShenandoahHeapRegion* r) {
@ -106,17 +109,6 @@ void ShenandoahCollectionSet::remove_region(ShenandoahHeapRegion* r) {
_region_count --;
}
void ShenandoahCollectionSet::update_region_status() {
for (size_t index = 0; index < _heap->num_regions(); index ++) {
ShenandoahHeapRegion* r = _heap->get_region(index);
if (is_in(r)) {
r->make_cset();
} else {
assert (!r->is_cset(), "should not be cset");
}
}
}
void ShenandoahCollectionSet::clear() {
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
Copy::zero_to_bytes(_cset_map, _map_size);

View File

@ -57,11 +57,6 @@ public:
void add_region(ShenandoahHeapRegion* r);
bool add_region_check_for_duplicates(ShenandoahHeapRegion* r);
// Bring per-region statuses to consistency with this collection.
// TODO: This is a transitional interface that bridges the gap between
// region statuses and this collection. Should go away after we merge them.
void update_region_status();
// Remove region from collection set
void remove_region(ShenandoahHeapRegion* r);

View File

@ -149,7 +149,6 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec
if (immediate_percent <= ShenandoahImmediateThreshold) {
choose_collection_set_from_regiondata(collection_set, candidates, cand_idx, immediate_garbage + free);
collection_set->update_region_status();
}
size_t cset_percent = (total_garbage == 0) ? 0 : (collection_set->garbage() * 100 / total_garbage);