# HG changeset patch # User zgu # Date 1552320238 14400 # Mon Mar 11 12:03:58 2019 -0400 # Node ID d0f8b44b253f6080d1f5280917c05c2c283eb51b # Parent 0324b3756aa261672d0f745b2a9a651fee69d262 Parallelize jni weak ref diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp @@ -34,7 +34,7 @@ #include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "gc/shenandoah/shenandoahVMOperations.hpp" -#include "gc/shared/weakProcessor.hpp" +#include "gc/shared/weakProcessor.inline.hpp" #include "memory/allocation.inline.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" @@ -47,7 +47,8 @@ _srs(n_workers), _par_state_string(StringTable::weak_storage()), _phase(phase), - _coderoots_all_iterator(ShenandoahCodeRoots::iterator()) + _coderoots_all_iterator(ShenandoahCodeRoots::iterator()), + _weak_processor_task(n_workers) { heap->phase_timings()->record_workers_start(_phase); @@ -192,10 +193,9 @@ SystemDictionary::oops_do(strong_roots); } if (jni_weak_roots != NULL) { - if (_process_strong_tasks->try_claim_task(SHENANDOAH_RP_PS_JNIHandles_weak_oops_do)) { ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIWeakRoots, worker_id); - WeakProcessor::oops_do(jni_weak_roots); - } + AlwaysTrueClosure always_true; + _weak_processor_task.work(worker_id, &always_true, jni_weak_roots); } if (ShenandoahStringDedup::is_enabled() && weak_roots != NULL) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp @@ -30,6 +30,7 @@ #include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahPhaseTimings.hpp" #include "gc/shared/strongRootsScope.hpp" +#include "gc/shared/weakProcessor.hpp" #include "gc/shared/workgroup.hpp" #include "memory/allocation.hpp" #include "memory/iterator.hpp" @@ -60,6 +61,7 @@ ParallelCLDRootIterator _cld_iterator; ShenandoahAllCodeRootsIterator _coderoots_all_iterator; CodeBlobClosure* _threads_nmethods_cl; + WeakProcessor::Task _weak_processor_task; void process_java_roots(OopClosure* scan_non_heap_roots, CLDClosure* scan_strong_clds,