--- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp Mon Jan 14 10:46:08 2019 +0000
+++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp Mon Jan 14 12:49:12 2019 +0100
@@ -377,19 +377,19 @@
// Complete marking under STW, and start evacuation
heap->vmop_entry_final_mark();
+ // Final mark might have reclaimed some immediate garbage, kick cleanup to reclaim
+ // the space. This would be the last action if there is nothing to evacuate.
+ heap->entry_cleanup();
+
+ {
+ ShenandoahHeapLocker locker(heap->lock());
+ heap->free_set()->log_status();
+ }
+
// Continue the cycle with evacuation and optional update-refs.
// This may be skipped if there is nothing to evacuate.
// If so, evac_in_progress would be unset by collection set preparation code.
if (heap->is_evacuation_in_progress()) {
- // Final mark had reclaimed some immediate garbage, kick cleanup to reclaim the space
- // for the rest of the cycle, and report current state of free set.
- heap->entry_cleanup();
-
- {
- ShenandoahHeapLocker locker(heap->lock());
- heap->free_set()->log_status();
- }
-
// Concurrently evacuate
heap->entry_evac();
if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_evac)) return;
@@ -403,14 +403,15 @@
if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_updaterefs)) return;
heap->vmop_entry_final_updaterefs();
+
+ // Update references freed up collection set, kick the cleanup to reclaim the space.
+ heap->entry_cleanup();
+
} else {
heap->vmop_entry_final_evac();
}
}
- // Reclaim space after cycle
- heap->entry_cleanup();
-
// Cycle is complete
heap->heuristics()->record_success_concurrent();
heap->shenandoah_policy()->record_success_concurrent();