1 /*
2 * Copyright (c) 2015, Red Hat, Inc. and/or its affiliates.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
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_VM_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
26
27 #include "classfile/classLoaderData.hpp"
28 #include "code/codeCache.hpp"
29 #include "memory/sharedHeap.hpp"
30 #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
31 #include "gc_implementation/shenandoah/shenandoahCollectorPolicy.hpp"
32 #include "gc_implementation/shenandoah/shenandoahCodeRoots.hpp"
33 #include "gc_implementation/shenandoah/shenandoahPhaseTimings.hpp"
34 #include "memory/allocation.hpp"
35 #include "runtime/mutex.hpp"
36
37 class CLDClosure;
38 class CodeBlobClosure;
39 class G1CollectedHeap;
40 class G1GCPhaseTimes;
41 class G1ParPushHeapRSClosure;
42 class Monitor;
43 class OopClosure;
44 class SubTasksDone;
45
46 class ParallelCLDRootIterator VALUE_OBJ_CLASS_SPEC {
47 public:
48 ParallelCLDRootIterator();
49 void root_cld_do(CLDClosure* strong, CLDClosure* weak);
50 };
51
52 enum Shenandoah_process_roots_tasks {
53 SHENANDOAH_RP_PS_Universe_oops_do,
54 SHENANDOAH_RP_PS_JNIHandles_oops_do,
55 SHENANDOAH_RP_PS_JNIHandles_weak_oops_do,
56 SHENANDOAH_RP_PS_FlatProfiler_oops_do,
57 SHENANDOAH_RP_PS_Management_oops_do,
58 SHENANDOAH_RP_PS_SystemDictionary_oops_do,
59 SHENANDOAH_RP_PS_jvmti_oops_do,
60 // Leave this one last.
61 SHENANDOAH_RP_PS_NumElements
62 };
63
64 class ShenandoahRootProcessor : public StackObj {
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);
103
104 // For slow debug/verification code
105 void process_all_roots_slow(OopClosure* oops);
106
107 // Number of worker threads used by the root processor.
108 uint n_workers() const;
109 };
110
111 class ShenandoahRootEvacuator : public StackObj {
112 SharedHeap::StrongRootsScope _srs;
113 ShenandoahPhaseTimings::Phase _phase;
114 ShenandoahCsetCodeRootsIterator _coderoots_cset_iterator;
115
116 public:
117 ShenandoahRootEvacuator(ShenandoahHeap* heap, uint n_workers,
118 ShenandoahPhaseTimings::Phase phase);
119 ~ShenandoahRootEvacuator();
120
121 void process_evacuate_roots(OopClosure* oops,
122 CodeBlobClosure* blobs,
123 uint worker_id);
124
125 // Number of worker threads used by the root processor.
126 uint n_workers() const;
127 };
128 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
|
1 /*
2 * Copyright (c) 2015, 2018, Red Hat, Inc. All rights reserved.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
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_VM_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
26
27 #include "code/codeCache.hpp"
28 #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
29 #include "gc_implementation/shenandoah/shenandoahCollectorPolicy.hpp"
30 #include "gc_implementation/shenandoah/shenandoahCodeRoots.hpp"
31 #include "gc_implementation/shenandoah/shenandoahPhaseTimings.hpp"
32 #include "memory/allocation.hpp"
33 #include "utilities/workgroup.hpp"
34
35 class ParallelCLDRootIterator VALUE_OBJ_CLASS_SPEC {
36 public:
37 ParallelCLDRootIterator();
38 void root_cld_do(CLDClosure* strong, CLDClosure* weak);
39 };
40
41 enum Shenandoah_process_roots_tasks {
42 SHENANDOAH_RP_PS_Universe_oops_do,
43 SHENANDOAH_RP_PS_JNIHandles_oops_do,
44 SHENANDOAH_RP_PS_JNIHandles_weak_oops_do,
45 SHENANDOAH_RP_PS_FlatProfiler_oops_do,
46 SHENANDOAH_RP_PS_Management_oops_do,
47 SHENANDOAH_RP_PS_SystemDictionary_oops_do,
48 SHENANDOAH_RP_PS_jvmti_oops_do,
49 // Leave this one last.
50 SHENANDOAH_RP_PS_NumElements
51 };
52
53 class ShenandoahRootProcessor : public StackObj {
81 CLDClosure* weak_clds,
82 CodeBlobClosure* blobs,
83 ThreadClosure* thread_cl,
84 uint worker_id);
85
86 // Apply oops, clds and blobs to strongly and weakly reachable roots in the system
87 void process_all_roots(OopClosure* oops, OopClosure* weak_oops,
88 CLDClosure* clds,
89 CodeBlobClosure* blobs,
90 ThreadClosure* thread_cl,
91 uint worker_id);
92
93 // For slow debug/verification code
94 void process_all_roots_slow(OopClosure* oops);
95
96 // Number of worker threads used by the root processor.
97 uint n_workers() const;
98 };
99
100 class ShenandoahRootEvacuator : public StackObj {
101 SubTasksDone* _evacuation_tasks;
102 SharedHeap::StrongRootsScope _srs;
103 ShenandoahPhaseTimings::Phase _phase;
104 ShenandoahCsetCodeRootsIterator _coderoots_cset_iterator;
105
106 enum Shenandoah_evacuate_roots_tasks {
107 SHENANDOAH_EVAC_jvmti_oops_do,
108 // Leave this one last.
109 SHENANDOAH_EVAC_NumElements
110 };
111 public:
112 ShenandoahRootEvacuator(ShenandoahHeap* heap, uint n_workers,
113 ShenandoahPhaseTimings::Phase phase);
114 ~ShenandoahRootEvacuator();
115
116 void process_evacuate_roots(OopClosure* oops,
117 CodeBlobClosure* blobs,
118 uint worker_id);
119
120 // Number of worker threads used by the root processor.
121 uint n_workers() const;
122 };
123 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
|