Skip to content

Commit 461f083

Browse files
committedApr 10, 2023
Move affiliation and mode out of ShenandoahGenerationalMode
Reviewed-by: kdnilsen, wkemper
1 parent 365e46a commit 461f083

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+337
-292
lines changed
 

‎src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(Shenand
9696
// more garbage. This represents one of the reasons why we keep looking at regions even after we decide, for example,
9797
// to exclude one of the regions because it might require evacuation of too much live data.
9898
bool is_generational = heap->mode()->is_generational();
99-
bool is_global = (_generation->generation_mode() == GLOBAL);
99+
bool is_global = _generation->is_global();
100100
size_t capacity = heap->young_generation()->max_capacity();
101101

102102
// cur_young_garbage represents the amount of memory to be reclaimed from young-gen. In the case that live objects

‎src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec
101101
bool is_generational = heap->mode()->is_generational();
102102

103103
assert(collection_set->count() == 0, "Must be empty");
104-
assert(_generation->generation_mode() != OLD, "Old GC invokes ShenandoahOldHeuristics::choose_collection_set()");
104+
assert(!_generation->is_old(), "Old GC invokes ShenandoahOldHeuristics::choose_collection_set()");
105105

106106
// Check all pinned regions have updated status before choosing the collection set.
107107
heap->assert_pinned_region_status();
@@ -141,7 +141,7 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec
141141
immediate_garbage += garbage;
142142
region->make_trash_immediate();
143143
} else {
144-
assert (_generation->generation_mode() != OLD, "OLD is handled elsewhere");
144+
assert(!_generation->is_old(), "OLD is handled elsewhere");
145145
live_memory += region->get_live_data_bytes();
146146
// This is our candidate for later consideration.
147147
candidates[cand_idx]._region = region;
@@ -369,15 +369,12 @@ double ShenandoahHeuristics::elapsed_cycle_time() const {
369369
}
370370

371371
bool ShenandoahHeuristics::in_generation(ShenandoahHeapRegion* region) {
372-
return ((_generation->generation_mode() == GLOBAL)
373-
|| (_generation->generation_mode() == YOUNG && region->affiliation() == YOUNG_GENERATION)
374-
|| (_generation->generation_mode() == OLD && region->affiliation() == OLD_GENERATION));
372+
return _generation->is_global()
373+
|| (_generation->is_young() && region->is_young())
374+
|| (_generation->is_old() && region->is_old());
375375
}
376376

377377
size_t ShenandoahHeuristics::min_free_threshold() {
378-
size_t min_free_threshold =
379-
_generation->generation_mode() == GenerationMode::OLD
380-
? ShenandoahOldMinFreeThreshold
381-
: ShenandoahMinFreeThreshold;
378+
size_t min_free_threshold = _generation->is_old() ? ShenandoahOldMinFreeThreshold : ShenandoahMinFreeThreshold;
382379
return _generation->soft_max_capacity() / 100 * min_free_threshold;
383380
}

0 commit comments

Comments
 (0)