begin work on more sensitive heuristics

This commit is contained in:
Kelvin Nilsen 2026-04-09 19:49:37 +00:00
parent 93baeb6f9e
commit 4ce8f27e9e
2 changed files with 21 additions and 0 deletions

View File

@ -341,6 +341,9 @@ double ShenandoahAdaptiveHeuristics::predict_mark_time(size_t anticipated_marked
}
double ShenandoahAdaptiveHeuristics::predict_evac_time(size_t anticipated_evac_words, size_t anticipated_pip_words) {
// The non-generational version of predict_evac_time() assumes no dependency on anticipated_pip_words,
// which should always equal zero.
assert(anticipate_pip_words == 0, "Non-generational mode has no promote in place");
return _phase_stats[ShenandoahMajorGCPhase::_evac].predict_at((double) (5 * anticipated_evac_words));
}
@ -349,6 +352,8 @@ double ShenandoahAdaptiveHeuristics::predict_update_time(size_t anticipated_upda
}
double ShenandoahAdaptiveHeuristics::predict_final_roots_time(size_t pip_words) {
// The non-generational version of predict_final_roots_time() assumes constant time, since pip_words is always zero.
assert(pip_words == 0, "Non-generational mode has no promote in place");
return _phase_stats[ShenandoahMajorGCPhase::_final_roots].predict_at((double) 0.0);
}

View File

@ -357,6 +357,22 @@ void ShenandoahYoungHeuristics:: update_anticipated_after_completed_gc(size_t ol
// start of a bootstrap cycle, and will surge workers at that time if necessary.
size_t anticipated_mark_words = get_young_live_words_after_most_recent_mark();
if (ShenandoahAllowOldMarkingPreemption || !next_cycle_is_bootstrap()) {
// This is the normal mode of operation.
// Words which recently became old due to promote-in-place, mixed-evacuation, or promotion by evacuation are
// conservatively flagged as dirty within the remembered set. The extra work required to clean this data during
// marking may result in much larger than normal times to scan the remembered set (e.g 714 ms vs 30 ms)
anticipated_mark_words = get_normal_young_mark_words() + get_recently_old_words();
} else {
// All Bootstrap GC cycles are Global cycles
}
// We'll assume all promotion is by evacuation. If we find out following mark that some of the promotion will be
// in place, we will adjust anticipation there. Assuming all promotion is by evacuation yields more conservative
// approximation of GC time.