< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp

Print this page

 56     assert(_mark.generation()->is_old(), "Generation of Old-Gen GC should be OLD");
 57     _mark.finish_mark();
 58     assert(!heap->cancelled_gc(), "STW mark cannot OOM");
 59 
 60     // Old collection is complete, the young generation no longer needs this
 61     // reference to the old concurrent mark so clean it up.
 62     heap->young_generation()->set_old_gen_task_queues(nullptr);
 63 
 64     // We need to do this because weak root cleaning reports the number of dead handles
 65     JvmtiTagMap::set_needs_cleaning();
 66 
 67     _generation->prepare_regions_and_collection_set(true);
 68 
 69     heap->set_unload_classes(false);
 70     heap->prepare_concurrent_roots();
 71 
 72     if (VerifyAfterGC) {
 73       Universe::verify();
 74     }
 75 



 76     {
 77       ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::final_mark_propagate_gc_state);
 78       heap->propagate_gc_state_to_all_threads();
 79     }
 80   }
 81 }
 82 
 83 bool ShenandoahOldGC::collect(GCCause::Cause cause) {
 84   auto heap = ShenandoahGenerationalHeap::heap();
 85   assert(!_old_generation->is_doing_mixed_evacuations(), "Should not start an old gc with pending mixed evacuations");
 86   assert(!_old_generation->is_preparing_for_mark(), "Old regions need to be parsable during concurrent mark.");
 87   heap->release_injected_pins();
 88 
 89   SHENANDOAH_EVENT_MESSAGE(msg, _generation->type(), "Concurrent GC", "");
 90   ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_gc, /* log_heap_usage = */ true);
 91 
 92   // Enable preemption of old generation mark.
 93   _allow_preemption.set();
 94 
 95   // Continue concurrent mark, do not reset regions, do not mark roots, do not collect $200.

121   // We aren't dealing with old generation evacuation yet. Our heuristic
122   // should not have built a cset in final mark.
123   assert(!heap->is_evacuation_in_progress(), "Old gen evacuations are not supported");
124 
125   // Process weak roots that might still point to regions that would be broken by cleanup
126   if (heap->is_concurrent_weak_root_in_progress()) {
127     entry_weak_refs();
128     entry_weak_roots();
129   }
130 
131   // Final mark might have reclaimed some immediate garbage, kick cleanup to reclaim
132   // the space. This would be the last action if there is nothing to evacuate.
133   entry_cleanup_early();
134 
135   assert(!heap->is_concurrent_strong_root_in_progress(), "No evacuations during old gc.");
136 
137   // We must execute this vm operation if we completed final mark. We cannot
138   // return from here with weak roots in progress. This is not a valid gc state
139   // for any young collections (or allocation failures) that interrupt the old
140   // collection.
141   entry_final_roots();
142 
143   // After concurrent old marking finishes, we reclaim immediate garbage. Further, we may also want to expand OLD in order
144   // to make room for anticipated promotions and/or for mixed evacuations.  Mixed evacuations are especially likely to
145   // follow the end of OLD marking.
146   heap->rebuild_free_set_within_phase();
147   heap->free_set()->log_status_under_lock();
148   return true;
149 }

 56     assert(_mark.generation()->is_old(), "Generation of Old-Gen GC should be OLD");
 57     _mark.finish_mark();
 58     assert(!heap->cancelled_gc(), "STW mark cannot OOM");
 59 
 60     // Old collection is complete, the young generation no longer needs this
 61     // reference to the old concurrent mark so clean it up.
 62     heap->young_generation()->set_old_gen_task_queues(nullptr);
 63 
 64     // We need to do this because weak root cleaning reports the number of dead handles
 65     JvmtiTagMap::set_needs_cleaning();
 66 
 67     _generation->prepare_regions_and_collection_set(true);
 68 
 69     heap->set_unload_classes(false);
 70     heap->prepare_concurrent_roots();
 71 
 72     if (VerifyAfterGC) {
 73       Universe::verify();
 74     }
 75 
 76     // Arm nmethods/stack for concurrent processing
 77     CodeCache::arm_all_nmethods();
 78 
 79     {
 80       ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::final_mark_propagate_gc_state);
 81       heap->propagate_gc_state_to_all_threads();
 82     }
 83   }
 84 }
 85 
 86 bool ShenandoahOldGC::collect(GCCause::Cause cause) {
 87   auto heap = ShenandoahGenerationalHeap::heap();
 88   assert(!_old_generation->is_doing_mixed_evacuations(), "Should not start an old gc with pending mixed evacuations");
 89   assert(!_old_generation->is_preparing_for_mark(), "Old regions need to be parsable during concurrent mark.");
 90   heap->release_injected_pins();
 91 
 92   SHENANDOAH_EVENT_MESSAGE(msg, _generation->type(), "Concurrent GC", "");
 93   ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_gc, /* log_heap_usage = */ true);
 94 
 95   // Enable preemption of old generation mark.
 96   _allow_preemption.set();
 97 
 98   // Continue concurrent mark, do not reset regions, do not mark roots, do not collect $200.

124   // We aren't dealing with old generation evacuation yet. Our heuristic
125   // should not have built a cset in final mark.
126   assert(!heap->is_evacuation_in_progress(), "Old gen evacuations are not supported");
127 
128   // Process weak roots that might still point to regions that would be broken by cleanup
129   if (heap->is_concurrent_weak_root_in_progress()) {
130     entry_weak_refs();
131     entry_weak_roots();
132   }
133 
134   // Final mark might have reclaimed some immediate garbage, kick cleanup to reclaim
135   // the space. This would be the last action if there is nothing to evacuate.
136   entry_cleanup_early();
137 
138   assert(!heap->is_concurrent_strong_root_in_progress(), "No evacuations during old gc.");
139 
140   // We must execute this vm operation if we completed final mark. We cannot
141   // return from here with weak roots in progress. This is not a valid gc state
142   // for any young collections (or allocation failures) that interrupt the old
143   // collection.
144   vmop_entry_final_roots();
145 
146   // After concurrent old marking finishes, we reclaim immediate garbage. Further, we may also want to expand OLD in order
147   // to make room for anticipated promotions and/or for mixed evacuations.  Mixed evacuations are especially likely to
148   // follow the end of OLD marking.
149   heap->rebuild_free_set_within_phase();
150   heap->free_set()->log_status_under_lock();
151   return true;
152 }
< prev index next >