< prev index next >
src/share/vm/gc_implementation/shenandoah/shenandoahControlThread.cpp
Print this page
rev 11461 : [backport] 8226757: Shenandoah: Make traversal and passive modes explicit
rev 11463 : Backport Traversal GC
@@ -31,10 +31,11 @@
#include "gc_implementation/shenandoah/shenandoahFreeSet.hpp"
#include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
#include "gc_implementation/shenandoah/shenandoahHeuristics.hpp"
#include "gc_implementation/shenandoah/shenandoahMonitoringSupport.hpp"
#include "gc_implementation/shenandoah/shenandoahPhaseTimings.hpp"
+#include "gc_implementation/shenandoah/shenandoahTraversalGC.hpp"
#include "gc_implementation/shenandoah/shenandoahUtils.hpp"
#include "gc_implementation/shenandoah/shenandoahVMOperations.hpp"
#include "gc_implementation/shenandoah/shenandoahWorkerPolicy.hpp"
#include "memory/iterator.hpp"
#include "memory/universe.hpp"
@@ -97,12 +98,14 @@
}
}
ShenandoahHeap* heap = ShenandoahHeap::heap();
- GCMode default_mode = concurrent_normal;
- GCCause::Cause default_cause = GCCause::_shenandoah_concurrent_gc;
+ 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();
double last_sleep_adjust_time = os::elapsedTime();
@@ -218,10 +221,13 @@
}
switch (mode) {
case none:
break;
+ case concurrent_traversal:
+ service_concurrent_traversal_cycle(cause);
+ break;
case concurrent_normal:
service_concurrent_normal_cycle(cause);
break;
case stw_degenerated:
service_stw_degenerated_cycle(cause, degen_point);
@@ -309,10 +315,34 @@
os::naked_short_sleep(ShenandoahControlIntervalMin);
}
terminate();
}
+void ShenandoahControlThread::service_concurrent_traversal_cycle(GCCause::Cause cause) {
+ ShenandoahGCSession session(cause);
+
+ ShenandoahHeap* heap = ShenandoahHeap::heap();
+ TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
+
+ // Reset for upcoming cycle
+ heap->entry_reset();
+
+ heap->vmop_entry_init_traversal();
+
+ if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_traversal)) return;
+
+ heap->entry_traversal();
+ if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_traversal)) return;
+
+ heap->vmop_entry_final_traversal();
+
+ heap->entry_cleanup();
+
+ heap->heuristics()->record_success_concurrent();
+ heap->shenandoah_policy()->record_success_concurrent();
+}
+
void ShenandoahControlThread::service_concurrent_normal_cycle(GCCause::Cause cause) {
// Normal cycle goes via all concurrent phases. If allocation failure (af) happens during
// any of the concurrent phases, it first degrades to Degenerated GC and completes GC there.
// If second allocation failure happens during Degenerated GC cycle (for example, when GC
// tries to evac something and no memory is available), cycle degrades to Full GC.
< prev index next >