--- old/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp 2019-06-18 13:08:46.181210440 -0400 +++ new/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp 2019-06-18 13:08:45.850210064 -0400 @@ -25,14 +25,83 @@ #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP #include "classfile/classLoaderDataGraph.hpp" +#include "classfile/stringTable.hpp" +#include "classfile/systemDictionary.hpp" #include "gc/shared/oopStorageParState.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahRootProcessor.hpp" #include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" +#include "prims/resolvedMethodTable.hpp" #include "memory/resourceArea.hpp" template +inline ShenandoahWeakRoot::ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase) : + _itr(storage), _phase(phase) { +} + +template +template +inline void ShenandoahWeakRoot::oops_do(Closure* cl, uint worker_id) { + if (CONCURRENT) { + _itr.oops_do(cl); + } else { + ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); + ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::ThreadRoots, worker_id); + _itr.oops_do(cl); + } +} + +inline ShenandoahWeakRoot::ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase) : + _itr(storage), _phase(phase) { +} + +template +void ShenandoahWeakRoot::weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id) { + ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); + ShenandoahWorkerTimingsTracker timer(worker_times, _phase, worker_id); + _itr.weak_oops_do(is_alive, keep_alive); +} + +template +ShenandoahWeakRoots::ShenandoahWeakRoots() : + _jni_roots(JNIHandles::weak_global_handles(), ShenandoahPhaseTimings::JNIWeakRoots), + _string_table_roots(StringTable::weak_storage(), ShenandoahPhaseTimings::StringTableRoots), + _resolved_method_table_roots(ResolvedMethodTable::weak_storage(), ShenandoahPhaseTimings::ResolvedMethodTableRoots), + _vm_roots(SystemDictionary::vm_weak_oop_storage(), ShenandoahPhaseTimings::VMWeakRoots) { +} + +template +template +void ShenandoahWeakRoots::oops_do(Closure* cl, uint worker_id) { + _jni_roots.oops_do(cl, worker_id); + _string_table_roots.oops_do(cl, worker_id); + _resolved_method_table_roots.oops_do(cl, worker_id); + _vm_roots.oops_do(cl, worker_id); +} + +inline ShenandoahWeakRoots::ShenandoahWeakRoots() : + _jni_roots(JNIHandles::weak_global_handles(), ShenandoahPhaseTimings::JNIWeakRoots), + _string_table_roots(StringTable::weak_storage(), ShenandoahPhaseTimings::StringTableRoots), + _resolved_method_table_roots(ResolvedMethodTable::weak_storage(), ShenandoahPhaseTimings::ResolvedMethodTableRoots), + _vm_roots(SystemDictionary::vm_weak_oop_storage(), ShenandoahPhaseTimings::VMWeakRoots) { +} + +template +void ShenandoahWeakRoots::weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id) { + _jni_roots.weak_oops_do(is_alive, keep_alive, worker_id); + _string_table_roots.weak_oops_do(is_alive, keep_alive, worker_id); + _resolved_method_table_roots.weak_oops_do(is_alive, keep_alive, worker_id); + _vm_roots.weak_oops_do(is_alive, keep_alive, worker_id); +} + +template +void ShenandoahWeakRoots::oops_do(Closure* cl, uint worker_id) { + AlwaysTrueClosure always_true; + weak_oops_do(&always_true, cl, worker_id); +} + +template ShenandoahJNIHandleRoots::ShenandoahJNIHandleRoots() : _claimed(false), _itr(JNIHandles::global_handles()) { @@ -52,11 +121,6 @@ } } -template -void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) { - _task.work(worker_id, is_alive, keep_alive); -} - template ShenandoahCodeCacheRoots::ShenandoahCodeCacheRoots() { nmethod::oops_do_marking_prologue(); @@ -188,7 +252,8 @@ _code_roots.code_blobs_do(&update_blobs, worker_id); } - _weak_roots.oops_do(is_alive, keep_alive, worker_id); + _serial_weak_roots.weak_oops_do(is_alive, keep_alive, worker_id); + _weak_roots.weak_oops_do(is_alive, keep_alive, worker_id); _dedup_roots.oops_do(is_alive, keep_alive, worker_id); }