< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahConcurrentThread.cpp
Print this page
rev 50076 : Fold Partial GC into Traversal GC
*** 28,38 ****
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
#include "gc/shenandoah/shenandoahFreeSet.hpp"
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
- #include "gc/shenandoah/shenandoahPartialGC.hpp"
#include "gc/shenandoah/shenandoahTraversalGC.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
#include "gc/shenandoah/vm_operations_shenandoah.hpp"
#include "memory/iterator.hpp"
--- 28,37 ----
*** 120,138 ****
mode = stw_full;
}
cause = _explicit_gc_cause;
} else {
// Potential normal cycle: ask heuristics if it wants to act
! if (policy->should_start_partial_gc()) {
! mode = concurrent_partial;
! cause = GCCause::_shenandoah_partial_gc;
! } else if (policy->should_start_traversal_gc()) {
mode = concurrent_traversal;
cause = GCCause::_shenandoah_traversal_gc;
} else if (policy->should_start_normal_gc()) {
mode = concurrent_normal;
cause = GCCause::_shenandoah_concurrent_gc;
}
// Ask policy if this cycle wants to process references or unload classes
heap->set_process_references(policy->should_process_references());
heap->set_unload_classes(policy->should_unload_classes());
--- 119,137 ----
mode = stw_full;
}
cause = _explicit_gc_cause;
} else {
// Potential normal cycle: ask heuristics if it wants to act
! ShenandoahHeap::GCCycleMode traversal_mode = policy->should_start_traversal_gc();
! if (traversal_mode != ShenandoahHeap::NONE) {
mode = concurrent_traversal;
cause = GCCause::_shenandoah_traversal_gc;
+ heap->set_cycle_mode(traversal_mode);
} else if (policy->should_start_normal_gc()) {
mode = concurrent_normal;
cause = GCCause::_shenandoah_concurrent_gc;
+ heap->set_cycle_mode(ShenandoahHeap::MAJOR);
}
// Ask policy if this cycle wants to process references or unload classes
heap->set_process_references(policy->should_process_references());
heap->set_unload_classes(policy->should_unload_classes());
*** 156,168 ****
}
switch (mode) {
case none:
break;
- case concurrent_partial:
- service_concurrent_partial_cycle(cause);
- break;
case concurrent_traversal:
service_concurrent_traversal_cycle(cause);
break;
case concurrent_normal:
service_concurrent_normal_cycle(cause);
--- 155,164 ----
*** 175,184 ****
--- 171,182 ----
break;
default:
ShouldNotReachHere();
}
+ heap->set_cycle_mode(ShenandoahHeap::NONE);
+
if (gc_requested) {
heap->set_used_at_last_gc();
// If this was the explicit GC cycle, notify waiters about it
if (explicit_gc_requested) {
*** 240,294 ****
while (!should_terminate()) {
os::naked_short_sleep(ShenandoahControlIntervalMin);
}
}
- void ShenandoahConcurrentThread::service_concurrent_partial_cycle(GCCause::Cause cause) {
- ShenandoahHeap* heap = ShenandoahHeap::heap();
- ShenandoahPartialGC* partial_gc = heap->partial_gc();
-
- if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_outside_cycle)) return;
-
- GCIdMark gc_id_mark;
- ShenandoahGCSession session;
-
- TraceCollectorStats tcs(heap->monitoring_support()->partial_collection_counters());
-
- heap->vmop_entry_init_partial();
- if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_partial)) return;
-
- if (!partial_gc->has_work()) return;
-
- heap->entry_partial();
- if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_partial)) return;
-
- heap->vmop_entry_final_partial();
- if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_partial)) return;
-
- heap->entry_cleanup();
-
- heap->shenandoahPolicy()->record_success_partial();
- }
-
void ShenandoahConcurrentThread::service_concurrent_traversal_cycle(GCCause::Cause cause) {
GCIdMark gc_id_mark;
ShenandoahGCSession session;
ShenandoahHeap* heap = ShenandoahHeap::heap();
! TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
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_bitmaps();
heap->shenandoahPolicy()->record_success_concurrent();
}
void ShenandoahConcurrentThread::service_concurrent_normal_cycle(GCCause::Cause cause) {
--- 238,266 ----
while (!should_terminate()) {
os::naked_short_sleep(ShenandoahControlIntervalMin);
}
}
void ShenandoahConcurrentThread::service_concurrent_traversal_cycle(GCCause::Cause cause) {
GCIdMark gc_id_mark;
ShenandoahGCSession session;
ShenandoahHeap* heap = ShenandoahHeap::heap();
! bool is_minor = heap->is_minor_gc();
! TraceCollectorStats tcs(is_minor ? heap->monitoring_support()->partial_collection_counters()
! : heap->monitoring_support()->concurrent_collection_counters());
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_traversal();
heap->shenandoahPolicy()->record_success_concurrent();
}
void ShenandoahConcurrentThread::service_concurrent_normal_cycle(GCCause::Cause cause) {
< prev index next >