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->old_generation()->is_bootstrapping();
267 heap->set_evacuation_in_progress(false);
268 heap->set_concurrent_weak_root_in_progress(false);
269 heap->set_concurrent_strong_root_in_progress(false);
270
271 // If heuristics thinks we should do the cycle, this flag would be set,
272 // and we need to do update-refs. Otherwise, it would be the shortcut cycle.
273 if (heap->has_forwarded_objects()) {
274 op_init_update_refs();
275 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
276 } else {
277 _abbreviated = true;
278 }
279
280 case _degenerated_update_refs:
281 if (heap->has_forwarded_objects()) {
282 op_update_refs();
283 op_update_roots();
284 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
285 }
286
287 // Disarm nmethods that armed in concurrent cycle.
288 // In above case, update roots should disarm them
289 ShenandoahCodeRoots::disarm_nmethods();
290
291 op_cleanup_complete();
292
293 if (heap->mode()->is_generational()) {
294 ShenandoahGenerationalHeap::heap()->complete_degenerated_cycle();
295 }
296
297 break;
298 default:
299 ShouldNotReachHere();
300 }
301
302 if (ShenandoahVerify) {
303 heap->verifier()->verify_after_degenerated(_generation);
304 }
305
306 if (VerifyAfterGC) {
307 Universe::verify();
308 }
309
|
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->old_generation()->is_bootstrapping();
268 heap->set_evacuation_in_progress(false);
269 heap->set_concurrent_weak_root_in_progress(false);
270 heap->set_concurrent_strong_root_in_progress(false);
271
272 // If heuristics thinks we should do the cycle, this flag would be set,
273 // and we need to do update-refs. Otherwise, it would be the shortcut cycle.
274 if (heap->has_forwarded_objects()) {
275 op_init_update_refs();
276 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
277 } else {
278 _abbreviated = true;
279 }
280
281 case _degenerated_update_refs:
282 if (heap->has_forwarded_objects()) {
283 op_update_refs();
284 op_update_roots();
285 assert(!heap->cancelled_gc(), "STW reference update can not OOM");
286 }
287
288 if (ShenandoahGCStateCheckHotpatch) {
289 // Leaving degenerated GC, we need to flip barriers back to idle.
290 ShenandoahCodeRoots::arm_nmethods();
291 ShenandoahStackWatermark::change_epoch_id();
292 } else {
293 // Disarm nmethods that armed in concurrent cycle.
294 // In above case, update roots should disarm them
295 ShenandoahCodeRoots::disarm_nmethods();
296 }
297
298 op_cleanup_complete();
299
300 if (heap->mode()->is_generational()) {
301 ShenandoahGenerationalHeap::heap()->complete_degenerated_cycle();
302 }
303
304 break;
305 default:
306 ShouldNotReachHere();
307 }
308
309 if (ShenandoahVerify) {
310 heap->verifier()->verify_after_degenerated(_generation);
311 }
312
313 if (VerifyAfterGC) {
314 Universe::verify();
315 }
316
|