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 // Enable preemption of old generation mark.
90 _allow_preemption.set();
91
92 // Continue concurrent mark, do not reset regions, do not mark roots, do not collect $200.
93 entry_mark();
94
95 // If we failed to unset the preemption flag, it means another thread has already unset it.
118 // We aren't dealing with old generation evacuation yet. Our heuristic
119 // should not have built a cset in final mark.
120 assert(!heap->is_evacuation_in_progress(), "Old gen evacuations are not supported");
121
122 // Process weak roots that might still point to regions that would be broken by cleanup
123 if (heap->is_concurrent_weak_root_in_progress()) {
124 entry_weak_refs();
125 entry_weak_roots();
126 }
127
128 // Final mark might have reclaimed some immediate garbage, kick cleanup to reclaim
129 // the space. This would be the last action if there is nothing to evacuate.
130 entry_cleanup_early();
131
132 assert(!heap->is_concurrent_strong_root_in_progress(), "No evacuations during old gc.");
133
134 // We must execute this vm operation if we completed final mark. We cannot
135 // return from here with weak roots in progress. This is not a valid gc state
136 // for any young collections (or allocation failures) that interrupt the old
137 // collection.
138 entry_final_roots();
139
140 // After concurrent old marking finishes, we reclaim immediate garbage. Further, we may also want to expand OLD in order
141 // to make room for anticipated promotions and/or for mixed evacuations. Mixed evacuations are especially likely to
142 // follow the end of OLD marking.
143 heap->rebuild_free_set_within_phase();
144 heap->free_set()->log_status_under_lock();
145 return true;
146 }
|
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 ShenandoahCodeRoots::arm_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 // 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.
96 entry_mark();
97
98 // If we failed to unset the preemption flag, it means another thread has already unset it.
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 vmop_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 }
|