19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26
27 #include "gc/shared/collectorCounters.hpp"
28 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
29 #include "gc/shenandoah/shenandoahConcurrentMark.hpp"
30 #include "gc/shenandoah/shenandoahDegeneratedGC.hpp"
31 #include "gc/shenandoah/shenandoahFullGC.hpp"
32 #include "gc/shenandoah/shenandoahGeneration.hpp"
33 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
34 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
35 #include "gc/shenandoah/shenandoahMetrics.hpp"
36 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
37 #include "gc/shenandoah/shenandoahOldGeneration.hpp"
38 #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
39 #include "gc/shenandoah/shenandoahSTWMark.hpp"
40 #include "gc/shenandoah/shenandoahUtils.hpp"
41 #include "gc/shenandoah/shenandoahVerifier.hpp"
42 #include "gc/shenandoah/shenandoahVMOperations.hpp"
43 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
44 #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
45 #include "runtime/vmThread.hpp"
46 #include "utilities/events.hpp"
47
48 ShenandoahDegenGC::ShenandoahDegenGC(ShenandoahDegenPoint degen_point, ShenandoahGeneration* generation) :
49 ShenandoahGC(generation),
50 _degen_point(degen_point),
51 _abbreviated(false) {
52 }
53
54 bool ShenandoahDegenGC::collect(GCCause::Cause cause) {
55 vmop_degenerated();
56 ShenandoahHeap* heap = ShenandoahHeap::heap();
57 if (heap->mode()->is_generational()) {
58 bool is_bootstrap_gc = heap->young_generation()->is_bootstrap_cycle();
283 // and we need to do update-refs. Otherwise, it would be the shortcut cycle.
284 if (heap->has_forwarded_objects()) {
285 op_init_update_refs();
286 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
287 } else {
288 _abbreviated = true;
289 }
290
291 // labs are retired, walk the old regions and update remembered set
292 if (ShenandoahHeap::heap()->mode()->is_generational()) {
293 ShenandoahGenerationalHeap::heap()->old_generation()->update_card_table();
294 }
295
296 case _degenerated_update_refs:
297 if (heap->has_forwarded_objects()) {
298 op_update_refs();
299 op_update_roots();
300 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
301 }
302
303 // Disarm nmethods that armed in concurrent cycle.
304 // In above case, update roots should disarm them
305 ShenandoahCodeRoots::disarm_nmethods();
306
307 op_cleanup_complete();
308
309 if (heap->mode()->is_generational()) {
310 ShenandoahGenerationalHeap::heap()->complete_degenerated_cycle();
311 }
312
313 break;
314 default:
315 ShouldNotReachHere();
316 }
317
318 DEBUG_ONLY(heap->assert_no_self_forwards());
319
320 if (ShenandoahVerify) {
321 heap->verifier()->verify_after_degenerated(_generation);
322 }
323
324 if (VerifyAfterGC) {
325 Universe::verify();
326 }
327
328 // Decide if this cycle made good progress, and, if not, should it upgrade to a full GC.
329 const bool progress = metrics.is_good_progress();
330 ShenandoahCollectorPolicy* policy = heap->shenandoah_policy();
331 policy->record_degenerated(_generation->is_young(), _abbreviated, progress);
332 if (progress) {
333 heap->notify_gc_progress();
334 _generation->heuristics()->record_degenerated();
335 heap->start_idle_span();
336 } else if (policy->should_upgrade_degenerated_gc()) {
337 // Upgrade to full GC, register full-GC impact on heuristics.
338 op_degenerated_futile();
339 } else {
|
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26
27 #include "gc/shared/collectorCounters.hpp"
28 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
29 #include "gc/shenandoah/shenandoahConcurrentMark.hpp"
30 #include "gc/shenandoah/shenandoahDegeneratedGC.hpp"
31 #include "gc/shenandoah/shenandoahFullGC.hpp"
32 #include "gc/shenandoah/shenandoahGeneration.hpp"
33 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
34 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
35 #include "gc/shenandoah/shenandoahMetrics.hpp"
36 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
37 #include "gc/shenandoah/shenandoahOldGeneration.hpp"
38 #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
39 #include "gc/shenandoah/shenandoahStackWatermark.hpp"
40 #include "gc/shenandoah/shenandoahSTWMark.hpp"
41 #include "gc/shenandoah/shenandoahUtils.hpp"
42 #include "gc/shenandoah/shenandoahVerifier.hpp"
43 #include "gc/shenandoah/shenandoahVMOperations.hpp"
44 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
45 #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
46 #include "runtime/vmThread.hpp"
47 #include "utilities/events.hpp"
48
49 ShenandoahDegenGC::ShenandoahDegenGC(ShenandoahDegenPoint degen_point, ShenandoahGeneration* generation) :
50 ShenandoahGC(generation),
51 _degen_point(degen_point),
52 _abbreviated(false) {
53 }
54
55 bool ShenandoahDegenGC::collect(GCCause::Cause cause) {
56 vmop_degenerated();
57 ShenandoahHeap* heap = ShenandoahHeap::heap();
58 if (heap->mode()->is_generational()) {
59 bool is_bootstrap_gc = heap->young_generation()->is_bootstrap_cycle();
284 // and we need to do update-refs. Otherwise, it would be the shortcut cycle.
285 if (heap->has_forwarded_objects()) {
286 op_init_update_refs();
287 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
288 } else {
289 _abbreviated = true;
290 }
291
292 // labs are retired, walk the old regions and update remembered set
293 if (ShenandoahHeap::heap()->mode()->is_generational()) {
294 ShenandoahGenerationalHeap::heap()->old_generation()->update_card_table();
295 }
296
297 case _degenerated_update_refs:
298 if (heap->has_forwarded_objects()) {
299 op_update_refs();
300 op_update_roots();
301 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
302 }
303
304 op_cleanup_complete();
305
306 if (heap->mode()->is_generational()) {
307 ShenandoahGenerationalHeap::heap()->complete_degenerated_cycle();
308 }
309
310 break;
311 default:
312 ShouldNotReachHere();
313 }
314
315 DEBUG_ONLY(heap->assert_no_self_forwards());
316
317 // Leaving degenerated GC, we need to flip barriers back to idle.
318 ShenandoahCodeRoots::arm_nmethods();
319 ShenandoahCodeRoots::disarm_nmethods();
320
321 if (ShenandoahVerify) {
322 heap->verifier()->verify_after_degenerated(_generation);
323 }
324
325 if (VerifyAfterGC) {
326 Universe::verify();
327 }
328
329 // Decide if this cycle made good progress, and, if not, should it upgrade to a full GC.
330 const bool progress = metrics.is_good_progress();
331 ShenandoahCollectorPolicy* policy = heap->shenandoah_policy();
332 policy->record_degenerated(_generation->is_young(), _abbreviated, progress);
333 if (progress) {
334 heap->notify_gc_progress();
335 _generation->heuristics()->record_degenerated();
336 heap->start_idle_span();
337 } else if (policy->should_upgrade_degenerated_gc()) {
338 // Upgrade to full GC, register full-GC impact on heuristics.
339 op_degenerated_futile();
340 } else {
|