--- old/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp 2020-05-27 08:58:06.313540495 -0400 +++ new/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp 2020-05-27 08:58:06.179539819 -0400 @@ -174,7 +174,10 @@ rp = NULL; } - _cm->concurrent_scan_code_roots(worker_id, rp); + if (!heap->unload_classes()) { + _cm->concurrent_scan_code_roots(worker_id, rp); + } + _cm->mark_loop(worker_id, _terminator, rp, true, // cancellable ShenandoahStringDedup::is_enabled()); // perform string dedup @@ -267,7 +270,8 @@ } } - if (heap->is_degenerated_gc_in_progress()) { + if (heap->is_degenerated_gc_in_progress() && + !heap->unload_classes()) { // Degenerated cycle may bypass concurrent cycle, so code roots might not be scanned, // let's check here. _cm->concurrent_scan_code_roots(worker_id, rp);