156 if (check_cancellation()) return;
157
158 // If we handed off remaining marking work above, we need to kick off waiting Java threads
159 if (clear_full_gc) {
160 reset_full_gc();
161 }
162
163 // Continue concurrent evacuation:
164 {
165 // Setup workers for concurrent evacuation phase
166 WorkGang* workers = heap->workers();
167 uint n_workers = ShenandoahCollectorPolicy::calc_workers_for_conc_evacuation(workers->active_workers(),
168 (uint) Threads::number_of_non_daemon_threads());
169 ShenandoahWorkerScope scope(workers, n_workers);
170
171 GCTraceTime(Info, gc) time("Concurrent evacuation ", gc_timer, GCCause::_no_gc, true);
172 TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
173 heap->do_evacuation();
174 }
175
176 // Prepare for the next normal cycle:
177 if (check_cancellation()) return;
178
179 {
180 GCTraceTime(Info, gc) time("Concurrent reset bitmaps", gc_timer, GCCause::_no_gc);
181 heap->shenandoahPolicy()->record_phase_start(ShenandoahCollectorPolicy::reset_bitmaps);
182 WorkGang* workers = heap->workers();
183 ShenandoahPushWorkerScope scope(workers, heap->max_workers());
184 heap->reset_next_mark_bitmap(workers);
185 heap->shenandoahPolicy()->record_phase_end(ShenandoahCollectorPolicy::reset_bitmaps);
186 }
187
188 gc_timer->register_gc_end();
189 }
190
191 bool ShenandoahConcurrentThread::check_cancellation() {
192 ShenandoahHeap* heap = ShenandoahHeap::heap();
193 if (heap->cancelled_concgc()) {
194 assert (is_full_gc() || in_graceful_shutdown(), "Cancel GC either for Full GC, or gracefully exiting");
195 heap->gc_timer()->register_gc_end();
|
156 if (check_cancellation()) return;
157
158 // If we handed off remaining marking work above, we need to kick off waiting Java threads
159 if (clear_full_gc) {
160 reset_full_gc();
161 }
162
163 // Continue concurrent evacuation:
164 {
165 // Setup workers for concurrent evacuation phase
166 WorkGang* workers = heap->workers();
167 uint n_workers = ShenandoahCollectorPolicy::calc_workers_for_conc_evacuation(workers->active_workers(),
168 (uint) Threads::number_of_non_daemon_threads());
169 ShenandoahWorkerScope scope(workers, n_workers);
170
171 GCTraceTime(Info, gc) time("Concurrent evacuation ", gc_timer, GCCause::_no_gc, true);
172 TraceCollectorStats tcs(heap->monitoring_support()->concurrent_collection_counters());
173 heap->do_evacuation();
174 }
175
176 // Do an update-refs phase if required.
177 if (check_cancellation()) return;
178
179 if (heap->shenandoahPolicy()->update_refs_early()) {
180
181 VM_ShenandoahPreUpdateRoots pre_update_roots;
182 VMThread::execute(&pre_update_roots);
183
184 {
185 GCTraceTime(Info, gc) time("Concurrent update references ", gc_timer, GCCause::_no_gc, true);
186 heap->concurrent_update_heap_references();
187 }
188 if (check_cancellation()) return;
189
190 VM_ShenandoahPostUpdateRoots post_update_roots;
191 VMThread::execute(&post_update_roots);
192 }
193
194 // Prepare for the next normal cycle:
195 if (check_cancellation()) return;
196
197 {
198 GCTraceTime(Info, gc) time("Concurrent reset bitmaps", gc_timer, GCCause::_no_gc);
199 heap->shenandoahPolicy()->record_phase_start(ShenandoahCollectorPolicy::reset_bitmaps);
200 WorkGang* workers = heap->workers();
201 ShenandoahPushWorkerScope scope(workers, heap->max_workers());
202 heap->reset_next_mark_bitmap(workers);
203 heap->shenandoahPolicy()->record_phase_end(ShenandoahCollectorPolicy::reset_bitmaps);
204 }
205
206 gc_timer->register_gc_end();
207 }
208
209 bool ShenandoahConcurrentThread::check_cancellation() {
210 ShenandoahHeap* heap = ShenandoahHeap::heap();
211 if (heap->cancelled_concgc()) {
212 assert (is_full_gc() || in_graceful_shutdown(), "Cancel GC either for Full GC, or gracefully exiting");
213 heap->gc_timer()->register_gc_end();
|