Skip to content

Commit

Permalink
8317534: GenShen: Remove unused code
Browse files Browse the repository at this point in the history
Reviewed-by: ysr, kdnilsen
  • Loading branch information
William Kemper committed Oct 10, 2023
1 parent ddd34c5 commit f3c9eda
Show file tree
Hide file tree
Showing 27 changed files with 23 additions and 286 deletions.
Expand Up @@ -245,7 +245,7 @@ bool ShenandoahAdaptiveHeuristics::should_start_gc() {
// 1. At certain phase changes, we may discard large amounts of data and replace it with large numbers of newly
// allocated objects. This "spike" looks more like a phase change. We were in steady state at M bytes/sec
// allocation rate and now we're in a "reinitialization phase" that looks like N bytes/sec. We need the "spike"
// accomodation to give us enough runway to recalibrate our "average allocation rate".
// accommodation to give us enough runway to recalibrate our "average allocation rate".
//
// 2. The typical workload changes. "Suddenly", our typical workload of N TPS increases to N+delta TPS. This means
// our average allocation rate needs to be adjusted. Once again, we need the "spike" accomodation to give us
Expand Down
Expand Up @@ -68,8 +68,6 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio

// This counts number of humongous regions that we intend to promote in this cycle.
size_t humongous_regions_promoted = 0;
// This counts bytes of memory used by humongous regions to be promoted in place.
size_t humongous_bytes_promoted = 0;
// This counts number of regular regions that will be promoted in place.
size_t regular_regions_promoted_in_place = 0;
// This counts bytes of memory used by regular regions to be promoted in place.
Expand Down Expand Up @@ -141,7 +139,6 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio
oop obj = cast_to_oop(region->bottom());
size_t humongous_regions = ShenandoahHeapRegion::required_regions(obj->size() * HeapWordSize);
humongous_regions_promoted += humongous_regions;
humongous_bytes_promoted += obj->size() * HeapWordSize;
}
}
} else if (region->is_trash()) {
Expand All @@ -151,9 +148,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio
}
}
heap->reserve_promotable_humongous_regions(humongous_regions_promoted);
heap->reserve_promotable_humongous_usage(humongous_bytes_promoted);
heap->reserve_promotable_regular_regions(regular_regions_promoted_in_place);
heap->reserve_promotable_regular_usage(regular_regions_promoted_usage);
log_info(gc, ergo)("Planning to promote in place " SIZE_FORMAT " humongous regions and " SIZE_FORMAT
" regular regions, spanning a total of " SIZE_FORMAT " used bytes",
humongous_regions_promoted, regular_regions_promoted_in_place,
Expand Down
10 changes: 4 additions & 6 deletions src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.hpp
Expand Up @@ -107,12 +107,6 @@ class ShenandoahAgeCensus: public CHeapObj<mtGC> {
uint *_tenuring_threshold; // An array of the last N tenuring threshold values we
// computed.

// A private work method invoked by the public compute_tenuring_threshold() method.
// This uses the data in the ShenandoahAgeCensus object's _global_age_table and the
// current _epoch to compute a new tenuring threshold, which will be remembered
// until the next invocation of compute_tenuring_threshold.
uint compute_tenuring_threshold_work();

// Mortality rate of a cohort, given its population in
// previous and current epochs
double mortality_rate(size_t prev_pop, size_t cur_pop);
Expand All @@ -121,6 +115,10 @@ class ShenandoahAgeCensus: public CHeapObj<mtGC> {
// compute_tenuring_threshold to calculate the new
// value
void update_tenuring_threshold();

// This uses the data in the ShenandoahAgeCensus object's _global_age_table and the
// current _epoch to compute a new tenuring threshold, which will be remembered
// until the next invocation of compute_tenuring_threshold.
uint compute_tenuring_threshold();

public:
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahCardTable.hpp
Expand Up @@ -79,10 +79,6 @@ class ShenandoahCardTable: public CardTable {
return _write_byte_map;
}

CardValue* read_byte_map_base() {
return _read_byte_map_base;
}

CardValue* write_byte_map_base() {
return _write_byte_map_base;
}
Expand Down
7 changes: 0 additions & 7 deletions src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp
Expand Up @@ -94,17 +94,14 @@ void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) {
size_t garbage = r->garbage();
size_t free = r->free();
if (r->is_young()) {
_young_region_count++;
_young_bytes_to_evacuate += live;
_young_available_bytes_collected += free;
if (ShenandoahHeap::heap()->mode()->is_generational() && r->age() >= ShenandoahHeap::heap()->age_census()->tenuring_threshold()) {
_young_bytes_to_promote += live;
}
} else if (r->is_old()) {
_old_region_count++;
_old_bytes_to_evacuate += live;
_old_garbage += garbage;
_old_available_bytes_collected += free;
}

_region_count++;
Expand Down Expand Up @@ -135,15 +132,11 @@ void ShenandoahCollectionSet::clear() {
_region_count = 0;
_current_index = 0;

_young_region_count = 0;
_young_bytes_to_evacuate = 0;
_young_bytes_to_promote = 0;

_old_region_count = 0;
_old_bytes_to_evacuate = 0;

_young_available_bytes_collected = 0;
_old_available_bytes_collected = 0;

_has_old_regions = false;
}
Expand Down
15 changes: 0 additions & 15 deletions src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp
Expand Up @@ -54,9 +54,6 @@ class ShenandoahCollectionSet : public CHeapObj<mtGC> {
size_t _young_bytes_to_promote;
size_t _old_bytes_to_evacuate;

size_t _young_region_count;
size_t _old_region_count;

// How many bytes of old garbage are present in a mixed collection set?
size_t _old_garbage;

Expand All @@ -68,7 +65,6 @@ class ShenandoahCollectionSet : public CHeapObj<mtGC> {
// When a region having memory available to be allocated is added to the collection set, the region's available memory
// should be subtracted from what's available.
size_t _young_available_bytes_collected;
size_t _old_available_bytes_collected;

shenandoah_padding(0);
volatile size_t _current_index;
Expand Down Expand Up @@ -100,12 +96,6 @@ class ShenandoahCollectionSet : public CHeapObj<mtGC> {

void print_on(outputStream* out) const;

// This represents total amount of work to be performed by evacuation, including evacuations to young, to old,
// and promotions from young to old. This equals get_young_bytes_reserved_for_evacuation() plus
// get_old_bytes_reserved_for_evacuation().
// TODO: Seems unused.
inline size_t get_bytes_reserved_for_evacuation();

// It is not known how many of these bytes will be promoted.
inline size_t get_young_bytes_reserved_for_evacuation();
inline size_t get_old_bytes_reserved_for_evacuation();
Expand All @@ -114,11 +104,6 @@ class ShenandoahCollectionSet : public CHeapObj<mtGC> {

size_t get_young_available_bytes_collected() { return _young_available_bytes_collected; }

size_t get_old_available_bytes_collected() { return _old_available_bytes_collected; }

inline size_t get_old_region_count();
inline size_t get_young_region_count();

inline size_t get_old_garbage();

void establish_preselected(bool *preselected) { _preselected_regions = preselected; }
Expand Down
12 changes: 0 additions & 12 deletions src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp
Expand Up @@ -66,18 +66,6 @@ size_t ShenandoahCollectionSet::get_young_bytes_to_be_promoted() {
return _young_bytes_to_promote;
}

size_t ShenandoahCollectionSet::get_bytes_reserved_for_evacuation() {
return _young_bytes_to_evacuate + _old_bytes_to_evacuate;
}

size_t ShenandoahCollectionSet::get_old_region_count() {
return _old_region_count;
}

size_t ShenandoahCollectionSet::get_young_region_count() {
return _young_region_count;
}

size_t ShenandoahCollectionSet::get_old_garbage() {
return _old_garbage;
}
Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp
Expand Up @@ -257,14 +257,8 @@ bool ShenandoahConcurrentGC::collect(GCCause::Cause cause) {
}
heap->set_old_region_surplus(0);
heap->set_old_region_deficit(0);

size_t old_usage_before_evac = heap->capture_old_usage(0);
size_t old_usage_now = old_gen->used();
size_t promoted_bytes = old_usage_now - old_usage_before_evac;
heap->set_previous_promotion(promoted_bytes);
heap->set_young_evac_reserve(0);
heap->set_old_evac_reserve(0);
heap->reset_old_evac_expended();
heap->set_promoted_reserve(0);
}

Expand Down
Expand Up @@ -88,7 +88,6 @@ class ShenandoahControlThread: public ConcurrentGCThread {
ShenandoahSharedFlag _preemption_requested;
ShenandoahSharedFlag _gc_requested;
ShenandoahSharedFlag _alloc_failure_gc;
ShenandoahSharedFlag _humongous_alloc_failure_gc;
ShenandoahSharedFlag _graceful_shutdown;
ShenandoahSharedFlag _do_counters_update;
ShenandoahSharedFlag _force_counters_update;
Expand Down
Expand Up @@ -332,7 +332,6 @@ void ShenandoahDegenGC::op_degenerated() {
// Otherwise, these actions have no effect.
heap->set_young_evac_reserve(0);
heap->set_old_evac_reserve(0);
heap->reset_old_evac_expended();
heap->set_promoted_reserve(0);
}

Expand Down
13 changes: 2 additions & 11 deletions src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
Expand Up @@ -895,7 +895,7 @@ HeapWord* ShenandoahFreeSet::allocate_contiguous(ShenandoahAllocRequest& req) {
}

end++;
};
}

size_t remainder = words_size & ShenandoahHeapRegion::region_size_words_mask();
ShenandoahMarkingContext* const ctx = _heap->complete_marking_context();
Expand Down Expand Up @@ -971,15 +971,6 @@ bool ShenandoahFreeSet::has_alloc_capacity(ShenandoahHeapRegion *r) const {
return alloc_capacity(r) > 0;
}

bool ShenandoahFreeSet::has_alloc_capacity(size_t idx) const {
ShenandoahHeapRegion* r = _heap->get_region(idx);
return alloc_capacity(r) > 0;
}

bool ShenandoahFreeSet::has_no_alloc_capacity(ShenandoahHeapRegion *r) const {
return alloc_capacity(r) == 0;
}

void ShenandoahFreeSet::try_recycle_trashed(ShenandoahHeapRegion *r) {
if (r->is_trash()) {
r->recycle();
Expand Down Expand Up @@ -1198,7 +1189,7 @@ void ShenandoahFreeSet::rebuild(size_t young_cset_regions, size_t old_cset_regio
old_capacity += xfer_bytes;
old_available += xfer_bytes;
old_unaffiliated_regions += old_region_deficit;
young_capacity -= xfer_bytes;;
young_capacity -= xfer_bytes;
young_available -= xfer_bytes;
young_unaffiliated_regions -= old_region_deficit;
}
Expand Down
10 changes: 0 additions & 10 deletions src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp
Expand Up @@ -172,23 +172,13 @@ class ShenandoahFreeSet : public CHeapObj<mtGC> {
void flip_to_gc(ShenandoahHeapRegion* r);
void flip_to_old_gc(ShenandoahHeapRegion* r);

void adjust_bounds_for_additional_old_collector_free_region(size_t idx);

void recompute_bounds();
void adjust_bounds();
bool touches_bounds(size_t num) const;

// Used of free set represents the amount of is_mutator_free set that has been consumed since most recent rebuild.
void increase_used(size_t amount);
void clear_internal();

void try_recycle_trashed(ShenandoahHeapRegion *r);

bool can_allocate_from(ShenandoahHeapRegion *r) const;
bool can_allocate_from(size_t idx) const;
bool has_alloc_capacity(size_t idx) const;
bool has_alloc_capacity(ShenandoahHeapRegion *r) const;
bool has_no_alloc_capacity(ShenandoahHeapRegion *r) const;

public:
ShenandoahFreeSet(ShenandoahHeap* heap, size_t max_regions);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp
Expand Up @@ -209,7 +209,6 @@ void ShenandoahFullGC::do_it(GCCause::Cause gc_cause) {
// No need for old_gen->increase_used() as this was done when plabs were allocated.
heap->set_young_evac_reserve(0);
heap->set_old_evac_reserve(0);
heap->reset_old_evac_expended();
heap->set_promoted_reserve(0);

// Full GC supersedes any marking or coalescing in old generation.
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp
Expand Up @@ -603,9 +603,9 @@ size_t ShenandoahGeneration::select_aged_regions(size_t old_available, size_t nu
// the region would be promoted in place) may be eligible for evacuation promotion by the time promotion takes
// place during a subsequent GC pass because more garbage is found within the region between now and then. This
// should not happen if we are properly adapting the tenure age. The theory behind adaptive tenuring threshold
// is to choose the youngest age that demonstrates no "significant" futher loss of population since the previous
// is to choose the youngest age that demonstrates no "significant" further loss of population since the previous
// age. If not this, we expect the tenure age to demonstrate linear population decay for at least two population
// samples, whereas we expect to observe exponetial population decay for ages younger than the tenure age.
// samples, whereas we expect to observe exponential population decay for ages younger than the tenure age.
//
// In the case that certain regions which were anticipated to be promoted in place need to be promoted by
// evacuation, it may be the case that there is not sufficient reserve within old-gen to hold evacuation of
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp
Expand Up @@ -135,10 +135,6 @@ class ShenandoahGeneration : public CHeapObj<mtGC>, public ShenandoahSpaceInfo {
void increase_capacity(size_t increment);
void decrease_capacity(size_t decrement);

void set_soft_max_capacity(size_t soft_max_capacity) {
_soft_max_capacity = soft_max_capacity;
}

void log_status(const char* msg) const;

// Used directly by FullGC
Expand Down
42 changes: 2 additions & 40 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Expand Up @@ -597,10 +597,7 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) :
_update_refs_iterator(this),
_promoted_reserve(0),
_old_evac_reserve(0),
_old_evac_expended(0),
_young_evac_reserve(0),
_captured_old_usage(0),
_previous_promotion(0),
_upgraded_to_full(false),
_age_census(nullptr),
_has_evacuation_reserve_quantities(false),
Expand All @@ -617,7 +614,7 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) :
_phase_timings(nullptr),
_evac_tracker(nullptr),
_mmu_tracker(),
_generation_sizer(&_mmu_tracker),
_generation_sizer(),
_monitoring_support(nullptr),
_memory_pool(nullptr),
_young_gen_memory_pool(nullptr),
Expand Down Expand Up @@ -973,7 +970,7 @@ void ShenandoahHeap::report_promotion_failure(Thread* thread, size_t size) {
if ((gc_id == last_report_epoch) && (epoch_report_count >= MaxReportsPerEpoch)) {
log_info(gc, ergo)("Squelching additional promotion failure reports for current epoch");
} else if (gc_id != last_report_epoch) {
last_report_epoch = gc_id;;
last_report_epoch = gc_id;
epoch_report_count = 1;
}
}
Expand Down Expand Up @@ -1180,10 +1177,6 @@ void ShenandoahHeap::cancel_old_gc() {
_old_generation->transition_to(ShenandoahOldGeneration::IDLE);
}

bool ShenandoahHeap::is_old_gc_active() {
return _old_generation->state() != ShenandoahOldGeneration::IDLE;
}

// xfer_limit is the maximum we're able to transfer from young to old
void ShenandoahHeap::adjust_generation_sizes_for_next_cycle(
size_t xfer_limit, size_t young_cset_regions, size_t old_cset_regions) {
Expand Down Expand Up @@ -1927,37 +1920,6 @@ void ShenandoahHeap::gclabs_retire(bool resize) {
}
}

class ShenandoahTagGCLABClosure : public ThreadClosure {
public:
void do_thread(Thread* thread) {
PLAB* gclab = ShenandoahThreadLocalData::gclab(thread);
assert(gclab != nullptr, "GCLAB should be initialized for %s", thread->name());
if (gclab->words_remaining() > 0) {
ShenandoahHeapRegion* r = ShenandoahHeap::heap()->heap_region_containing(gclab->allocate(0));
r->set_young_lab_flag();
}
}
};

void ShenandoahHeap::set_young_lab_region_flags() {
if (!UseTLAB) {
return;
}
for (size_t i = 0; i < _num_regions; i++) {
_regions[i]->clear_young_lab_flags();
}
ShenandoahTagGCLABClosure cl;
workers()->threads_do(&cl);
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
cl.do_thread(t);
ThreadLocalAllocBuffer& tlab = t->tlab();
if (tlab.end() != nullptr) {
ShenandoahHeapRegion* r = heap_region_containing(tlab.start());
r->set_young_lab_flag();
}
}
}

// Returns size in bytes
size_t ShenandoahHeap::unsafe_max_tlab_alloc(Thread *thread) const {
if (ShenandoahElasticTLAB) {
Expand Down

0 comments on commit f3c9eda

Please sign in to comment.