--- old/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp 2019-06-12 11:28:19.489231453 -0400 +++ new/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp 2019-06-12 11:28:19.155231124 -0400 @@ -130,10 +130,16 @@ ClassLoaderDataGraph::clear_claimed_marks(); } -void ShenandoahClassLoaderDataRoots::clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id) { +void ShenandoahClassLoaderDataRoots::always_strong_cld_do(CLDClosure* clds, uint worker_id) { ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id); - ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); + ClassLoaderDataGraph::always_strong_cld_do(clds); +} + +void ShenandoahClassLoaderDataRoots::cld_do(CLDClosure* clds, uint worker_id) { + ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); + ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id); + ClassLoaderDataGraph::cld_do(clds); } ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) : @@ -165,7 +171,7 @@ _jni_roots.oops_do(oops, worker_id); _thread_roots.oops_do(oops, NULL, worker_id); - _cld_roots.clds_do(&clds, &clds, worker_id); + _cld_roots.cld_do(&clds, worker_id); _code_roots.code_blobs_do(&blobsCl, worker_id); _weak_roots.oops_do(&always_true, oops, worker_id); @@ -195,7 +201,7 @@ _jni_roots.oops_do(oops, worker_id); _thread_roots.oops_do(oops, NULL, worker_id); - _cld_roots.clds_do(&adjust_cld_closure, NULL, worker_id); + _cld_roots.cld_do(&adjust_cld_closure, worker_id); _code_roots.code_blobs_do(&adjust_code_closure, worker_id); _weak_roots.oops_do(&always_true, oops, worker_id); --- old/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp 2019-06-12 11:28:20.280232231 -0400 +++ new/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp 2019-06-12 11:28:19.939231896 -0400 @@ -112,7 +112,8 @@ public: ShenandoahClassLoaderDataRoots(); - void clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id); + void always_strong_cld_do(CLDClosure* clds, uint worker_id); + void cld_do(CLDClosure* clds, uint worker_id); }; class ShenandoahRootProcessor : public StackObj { --- old/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp 2019-06-12 11:28:21.085233024 -0400 +++ new/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp 2019-06-12 11:28:20.706232651 -0400 @@ -100,7 +100,13 @@ _serial_roots.oops_do(oops, worker_id); _jni_roots.oops_do(oops, worker_id); - _cld_roots.clds_do(clds, clds, worker_id); + + if (clds != NULL) { + _cld_roots.cld_do(clds, worker_id); + } else { + assert(ShenandoahHeap::heap()->is_concurrent_traversal_in_progress(), "Only possible with traversal GC"); + } + _thread_roots.threads_do(&tc_cl, worker_id); // With ShenandoahConcurrentScanCodeRoots, we avoid scanning the entire code cache here, @@ -120,7 +126,7 @@ _serial_roots.oops_do(oops, 0); _jni_roots.oops_do(oops, 0); - _cld_roots.clds_do(&clds, &clds, 0); + _cld_roots.cld_do(&clds, 0); _thread_roots.threads_do(&tc_cl, 0); _code_roots.code_blobs_do(&code, 0); } @@ -134,7 +140,7 @@ _serial_roots.oops_do(oops, 0); _jni_roots.oops_do(oops, 0); - _cld_roots.clds_do(&clds, NULL, 0); + _cld_roots.always_strong_cld_do(&clds, 0); _thread_roots.threads_do(&tc_cl, 0); } @@ -146,7 +152,7 @@ _serial_roots.oops_do(oops, worker_id); _jni_roots.oops_do(oops, worker_id); - _cld_roots.clds_do(clds, NULL, worker_id); + _cld_roots.always_strong_cld_do(clds, worker_id); _thread_roots.threads_do(&tc_cl, worker_id); } @@ -154,13 +160,12 @@ void ShenandoahRootUpdater::roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive) { CodeBlobToOopClosure update_blobs(keep_alive, CodeBlobToOopClosure::FixRelocations); CLDToOopClosure clds(keep_alive, ClassLoaderData::_claim_strong); - CLDToOopClosure* weak_clds = ShenandoahHeap::heap()->unload_classes() ? NULL : &clds; _serial_roots.oops_do(keep_alive, worker_id); _jni_roots.oops_do(keep_alive, worker_id); _thread_roots.oops_do(keep_alive, NULL, worker_id); - _cld_roots.clds_do(&clds, weak_clds, worker_id); + _cld_roots.cld_do(&clds, worker_id); if(_update_code_cache) { _code_roots.code_blobs_do(&update_blobs, worker_id);