Skip to content
Permalink
Browse files

8242227: Shenandoah: transit regions to cset state when adding to col…

…lection set

Reviewed-by: rkennke
  • Loading branch information
shipilev committed Apr 6, 2020
1 parent 59f28e5 commit 0d1e636aba7d8110d6e38ad965d933eff44fb71d
@@ -88,6 +88,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) {
@@ -107,17 +110,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);
@@ -58,11 +58,6 @@ class ShenandoahCollectionSet : public CHeapObj<mtGC> {
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);

@@ -150,7 +150,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);

0 comments on commit 0d1e636

Please sign in to comment.