14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP 25 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP 26 27 #include "code/codeCache.hpp" 28 #include "gc/shared/oopStorageParState.hpp" 29 #include "gc/shenandoah/shenandoahCodeRoots.hpp" 30 #include "gc/shenandoah/shenandoahHeap.hpp" 31 #include "gc/shenandoah/shenandoahPhaseTimings.hpp" 32 #include "gc/shared/strongRootsScope.hpp" 33 #include "gc/shared/weakProcessor.hpp" 34 #include "gc/shared/workgroup.hpp" 35 #include "memory/allocation.hpp" 36 #include "memory/iterator.hpp" 37 38 class ParallelCLDRootIterator { 39 public: 40 ParallelCLDRootIterator(); 41 void root_cld_do(CLDClosure* strong, CLDClosure* weak); 42 }; 43 44 enum Shenandoah_process_roots_tasks { 45 SHENANDOAH_RP_PS_Universe_oops_do, 46 SHENANDOAH_RP_PS_JNIHandles_oops_do, 47 SHENANDOAH_RP_PS_ObjectSynchronizer_oops_do, 48 SHENANDOAH_RP_PS_Management_oops_do, 49 SHENANDOAH_RP_PS_SystemDictionary_oops_do, 50 SHENANDOAH_RP_PS_jvmti_oops_do, 51 // Leave this one last. 52 SHENANDOAH_RP_PS_NumElements 53 }; 54 55 class ShenandoahRootProcessor : public StackObj { 56 SubTasksDone* _process_strong_tasks; 57 StrongRootsScope _srs; 58 OopStorage::ParState<false, false> _par_state_string; 59 ShenandoahPhaseTimings::Phase _phase; 60 ParallelCLDRootIterator _cld_iterator; 61 ShenandoahAllCodeRootsIterator _coderoots_all_iterator; 62 CodeBlobClosure* _threads_nmethods_cl; 63 WeakProcessor::Task _weak_processor_task; 64 65 void process_java_roots(OopClosure* scan_non_heap_roots, 66 CLDClosure* scan_strong_clds, 67 CLDClosure* scan_weak_clds, 68 CodeBlobClosure* scan_strong_code, 69 ThreadClosure* thread_cl, 70 uint worker_i); 71 72 void process_vm_roots(OopClosure* scan_non_heap_roots, 73 OopClosure* scan_non_heap_weak_roots, 74 OopClosure* weak_jni_roots, 75 uint worker_i); 76 77 public: 78 ShenandoahRootProcessor(ShenandoahHeap* heap, uint n_workers, 79 ShenandoahPhaseTimings::Phase phase); 80 ~ShenandoahRootProcessor(); 81 82 // Apply oops, clds and blobs to all strongly reachable roots in the system 83 void process_strong_roots(OopClosure* oops, OopClosure* weak_oops, 84 CLDClosure* clds, 85 CLDClosure* weak_clds, 86 CodeBlobClosure* blobs, 87 ThreadClosure* thread_cl, 88 uint worker_id); 89 90 // Apply oops, clds and blobs to strongly and weakly reachable roots in the system 91 void process_all_roots(OopClosure* oops, OopClosure* weak_oops, 92 CLDClosure* clds, 93 CodeBlobClosure* blobs, 94 ThreadClosure* thread_cl, 95 uint worker_id); | 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP 25 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP 26 27 #include "code/codeCache.hpp" 28 #include "gc/shared/oopStorageParState.hpp" 29 #include "gc/shenandoah/shenandoahCodeRoots.hpp" 30 #include "gc/shenandoah/shenandoahHeap.hpp" 31 #include "gc/shenandoah/shenandoahPhaseTimings.hpp" 32 #include "gc/shared/strongRootsScope.hpp" 33 #include "gc/shared/weakProcessor.hpp" 34 #include "gc/shared/weakProcessorPhaseTimes.hpp" 35 #include "gc/shared/workgroup.hpp" 36 #include "memory/allocation.hpp" 37 #include "memory/iterator.hpp" 38 39 class ParallelCLDRootIterator { 40 public: 41 ParallelCLDRootIterator(); 42 void root_cld_do(CLDClosure* strong, CLDClosure* weak); 43 }; 44 45 enum Shenandoah_process_roots_tasks { 46 SHENANDOAH_RP_PS_Universe_oops_do, 47 SHENANDOAH_RP_PS_JNIHandles_oops_do, 48 SHENANDOAH_RP_PS_ObjectSynchronizer_oops_do, 49 SHENANDOAH_RP_PS_Management_oops_do, 50 SHENANDOAH_RP_PS_SystemDictionary_oops_do, 51 SHENANDOAH_RP_PS_jvmti_oops_do, 52 // Leave this one last. 53 SHENANDOAH_RP_PS_NumElements 54 }; 55 56 class ShenandoahRootProcessor : public StackObj { 57 SubTasksDone* _process_strong_tasks; 58 StrongRootsScope _srs; 59 OopStorage::ParState<false, false> _par_state_string; 60 ShenandoahPhaseTimings::Phase _phase; 61 ParallelCLDRootIterator _cld_iterator; 62 ShenandoahAllCodeRootsIterator _coderoots_all_iterator; 63 CodeBlobClosure* _threads_nmethods_cl; 64 WeakProcessorPhaseTimes _weak_processor_timings; 65 WeakProcessor::Task _weak_processor_task; 66 bool _processed_weak_roots; 67 68 void process_java_roots(OopClosure* scan_non_heap_roots, 69 CLDClosure* scan_strong_clds, 70 CLDClosure* scan_weak_clds, 71 CodeBlobClosure* scan_strong_code, 72 ThreadClosure* thread_cl, 73 uint worker_i); 74 75 void process_vm_roots(OopClosure* scan_non_heap_roots, 76 OopClosure* scan_non_heap_weak_roots, 77 OopClosure* weak_jni_roots, 78 uint worker_i); 79 80 void weak_processor_timing_to_shenandoah_timing(const WeakProcessorPhases::Phase wpp, 81 const ShenandoahPhaseTimings::GCParPhases spp, 82 ShenandoahWorkerTimings* worker_times) const; 83 84 public: 85 ShenandoahRootProcessor(ShenandoahHeap* heap, uint n_workers, 86 ShenandoahPhaseTimings::Phase phase); 87 ~ShenandoahRootProcessor(); 88 89 // Apply oops, clds and blobs to all strongly reachable roots in the system 90 void process_strong_roots(OopClosure* oops, OopClosure* weak_oops, 91 CLDClosure* clds, 92 CLDClosure* weak_clds, 93 CodeBlobClosure* blobs, 94 ThreadClosure* thread_cl, 95 uint worker_id); 96 97 // Apply oops, clds and blobs to strongly and weakly reachable roots in the system 98 void process_all_roots(OopClosure* oops, OopClosure* weak_oops, 99 CLDClosure* clds, 100 CodeBlobClosure* blobs, 101 ThreadClosure* thread_cl, 102 uint worker_id); |