8226757: Shenandoah: Make traversal and passive modes explicit

Reviewed-by: shade
This commit is contained in:
Roman Kennke 2019-07-04 14:28:31 +02:00
parent ba3ba19536
commit d4afa4e1c8
58 changed files with 588 additions and 326 deletions

View file

@ -68,6 +68,10 @@ void ShenandoahPeriodicSATBFlushTask::task() {
void ShenandoahControlThread::run_service() {
ShenandoahHeap* heap = ShenandoahHeap::heap();
GCMode default_mode = heap->is_traversal_mode() ?
concurrent_traversal : concurrent_normal;
GCCause::Cause default_cause = heap->is_traversal_mode() ?
GCCause::_shenandoah_traversal_gc : GCCause::_shenandoah_concurrent_gc;
int sleep = ShenandoahControlIntervalMin;
double last_shrink_time = os::elapsedTime();
@ -123,11 +127,7 @@ void ShenandoahControlThread::run_service() {
if (ExplicitGCInvokesConcurrent) {
policy->record_explicit_to_concurrent();
if (heuristics->can_do_traversal_gc()) {
mode = concurrent_traversal;
} else {
mode = concurrent_normal;
}
mode = default_mode;
// Unload and clean up everything
heap->set_process_references(heuristics->can_process_references());
heap->set_unload_classes(heuristics->can_unload_classes());
@ -143,11 +143,7 @@ void ShenandoahControlThread::run_service() {
if (ShenandoahImplicitGCInvokesConcurrent) {
policy->record_implicit_to_concurrent();
if (heuristics->can_do_traversal_gc()) {
mode = concurrent_traversal;
} else {
mode = concurrent_normal;
}
mode = default_mode;
// Unload and clean up everything
heap->set_process_references(heuristics->can_process_references());
@ -158,12 +154,9 @@ void ShenandoahControlThread::run_service() {
}
} else {
// Potential normal cycle: ask heuristics if it wants to act
if (heuristics->should_start_traversal_gc()) {
mode = concurrent_traversal;
cause = GCCause::_shenandoah_traversal_gc;
} else if (heuristics->should_start_normal_gc()) {
mode = concurrent_normal;
cause = GCCause::_shenandoah_concurrent_gc;
if (heuristics->should_start_gc()) {
mode = default_mode;
cause = default_cause;
}
// Ask policy if this cycle wants to process references or unload classes