44 const OopsDo _oops_do;
45 const ShenandoahPhaseTimings::GCParPhases _phase;
46
47 public:
48 ShenandoahSerialRoot(OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
49 void oops_do(OopClosure* cl, uint worker_id);
50 };
51
52 class ShenandoahSerialRoots {
53 private:
54 ShenandoahSerialRoot _universe_root;
55 ShenandoahSerialRoot _object_synchronizer_root;
56 ShenandoahSerialRoot _management_root;
57 ShenandoahSerialRoot _system_dictionary_root;
58 ShenandoahSerialRoot _jvmti_root;
59 public:
60 ShenandoahSerialRoots();
61 void oops_do(OopClosure* cl, uint worker_id);
62 };
63
64 template <bool CONCURRENT = false>
65 class ShenandoahJNIHandleRoots {
66 private:
67 volatile bool _claimed;
68 OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
69 public:
70 ShenandoahJNIHandleRoots();
71
72 template <typename T>
73 void oops_do(T* cl, uint worker_id = 0);
74 };
75
76 class ShenandoahThreadRoots {
77 private:
78 const bool _is_par;
79 public:
80 ShenandoahThreadRoots(bool is_par);
81 ~ShenandoahThreadRoots();
82
83 void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
84 void threads_do(ThreadClosure* tc, uint worker_id);
85 };
86
87 class ShenandoahWeakRoots {
88 private:
89 WeakProcessorPhaseTimes _process_timings;
90 WeakProcessor::Task _task;
91 public:
92 ShenandoahWeakRoots(uint n_workers);
93 ~ShenandoahWeakRoots();
94
95 template <typename IsAlive, typename KeepAlive>
96 void oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id);
97 };
98
99 class ShenandoahStringDedupRoots {
100 public:
101 ShenandoahStringDedupRoots();
102 ~ShenandoahStringDedupRoots();
103
104 void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
105 };
106
107 template <typename ITR>
108 class ShenandoahCodeCacheRoots {
109 private:
110 ITR _coderoots_iterator;
111 public:
112 ShenandoahCodeCacheRoots();
113 ~ShenandoahCodeCacheRoots();
114
115 void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
116 };
117
118 class ShenandoahClassLoaderDataRoots {
151
152 // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
153 // roots when class unloading is disabled during this cycle
154 void roots_do(uint worker_id, OopClosure* cl);
155 void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
156 // For heap object iteration
157 void roots_do_unchecked(OopClosure* cl);
158 void strong_roots_do_unchecked(OopClosure* cl);
159 };
160
161 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
162 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
163
164 // Evacuate all roots at a safepoint
165 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
166 private:
167 ShenandoahSerialRoots _serial_roots;
168 ShenandoahJNIHandleRoots<> _jni_roots;
169 ShenandoahClassLoaderDataRoots _cld_roots;
170 ShenandoahThreadRoots _thread_roots;
171 ShenandoahWeakRoots _weak_roots;
172 ShenandoahStringDedupRoots _dedup_roots;
173 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
174 bool _include_concurrent_roots;
175
176 public:
177 ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
178
179 void roots_do(uint worker_id, OopClosure* oops);
180 };
181
182 // Update all roots at a safepoint
183 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
184 private:
185 ShenandoahSerialRoots _serial_roots;
186 ShenandoahJNIHandleRoots<> _jni_roots;
187 ShenandoahClassLoaderDataRoots _cld_roots;
188 ShenandoahThreadRoots _thread_roots;
189 ShenandoahWeakRoots _weak_roots;
190 ShenandoahStringDedupRoots _dedup_roots;
191 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
192 const bool _update_code_cache;
193
194 public:
195 ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
196
197 template<typename IsAlive, typename KeepAlive>
198 void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
199 };
200
201 // Adjuster all roots at a safepoint during full gc
202 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
203 private:
204 ShenandoahSerialRoots _serial_roots;
205 ShenandoahJNIHandleRoots<> _jni_roots;
206 ShenandoahClassLoaderDataRoots _cld_roots;
207 ShenandoahThreadRoots _thread_roots;
208 ShenandoahWeakRoots _weak_roots;
209 ShenandoahStringDedupRoots _dedup_roots;
210 ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
211
212 public:
213 ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
214
215 void roots_do(uint worker_id, OopClosure* oops);
216 };
217
218 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
|
44 const OopsDo _oops_do;
45 const ShenandoahPhaseTimings::GCParPhases _phase;
46
47 public:
48 ShenandoahSerialRoot(OopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
49 void oops_do(OopClosure* cl, uint worker_id);
50 };
51
52 class ShenandoahSerialRoots {
53 private:
54 ShenandoahSerialRoot _universe_root;
55 ShenandoahSerialRoot _object_synchronizer_root;
56 ShenandoahSerialRoot _management_root;
57 ShenandoahSerialRoot _system_dictionary_root;
58 ShenandoahSerialRoot _jvmti_root;
59 public:
60 ShenandoahSerialRoots();
61 void oops_do(OopClosure* cl, uint worker_id);
62 };
63
64 class ShenandoahWeakSerialRoot {
65 typedef void (*WeakOopsDo)(BoolObjectClosure*, OopClosure*);
66 private:
67 volatile bool _claimed;
68 const WeakOopsDo _weak_oops_do;
69 const ShenandoahPhaseTimings::GCParPhases _phase;
70
71 public:
72 ShenandoahWeakSerialRoot(WeakOopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
73 void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
74 };
75
76 #if INCLUDE_JVMTI
77 class ShenandoahJVMTIWeakRoot : public ShenandoahWeakSerialRoot {
78 public:
79 ShenandoahJVMTIWeakRoot();
80 };
81 #endif // INCLUDE_JVMTI
82
83 #if INCLUDE_JFR
84 class ShenandoahJFRWeakRoot : public ShenandoahWeakSerialRoot {
85 public:
86 ShenandoahJFRWeakRoot();
87 };
88 #endif // INCLUDE_JFR
89
90 class ShenandoahSerialWeakRoots {
91 private:
92 JVMTI_ONLY(ShenandoahJVMTIWeakRoot _jvmti_weak_roots;)
93 JFR_ONLY(ShenandoahJFRWeakRoot _jfr_weak_roots;)
94 public:
95 void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
96 void weak_oops_do(OopClosure* cl, uint worker_id);
97 };
98
99 template <bool CONCURRENT = false>
100 class ShenandoahWeakRoot {
101 private:
102 OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
103 const ShenandoahPhaseTimings::GCParPhases _phase;
104 public:
105 ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
106
107 template <typename Closure>
108 void oops_do(Closure* cl, uint worker_id);
109 };
110
111 template <>
112 class ShenandoahWeakRoot<false> {
113 private:
114 OopStorage::ParState<false /* concurrent */, false /* is_const */> _itr;
115 const ShenandoahPhaseTimings::GCParPhases _phase;
116
117 public:
118 ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
119
120 template <typename IsAliveClosure, typename KeepAliveClosure>
121 void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
122 };
123
124 template <bool CONCURRENT = false>
125 class ShenandoahWeakRoots {
126 private:
127 ShenandoahWeakRoot<CONCURRENT> _jni_roots;
128 ShenandoahWeakRoot<CONCURRENT> _string_table_roots;
129 ShenandoahWeakRoot<CONCURRENT> _resolved_method_table_roots;
130 ShenandoahWeakRoot<CONCURRENT> _vm_roots;
131
132 public:
133 ShenandoahWeakRoots();
134
135 template <typename Closure>
136 void oops_do(Closure* cl, uint worker_id = 0);
137 };
138
139 template <>
140 class ShenandoahWeakRoots<false /* concurrent */> {
141 private:
142 ShenandoahWeakRoot<> _jni_roots;
143 ShenandoahWeakRoot<> _string_table_roots;
144 ShenandoahWeakRoot<> _resolved_method_table_roots;
145 ShenandoahWeakRoot<> _vm_roots;
146 public:
147 ShenandoahWeakRoots();
148
149 template <typename Closure>
150 void oops_do(Closure* cl, uint worker_id = 0);
151
152 template <typename IsAliveClosure, typename KeepAliveClosure>
153 void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
154 };
155
156 template <bool CONCURRENT = false>
157 class ShenandoahJNIHandleRoots {
158 private:
159 volatile bool _claimed;
160 OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
161 public:
162 ShenandoahJNIHandleRoots();
163
164 template <typename T>
165 void oops_do(T* cl, uint worker_id = 0);
166 };
167
168 class ShenandoahThreadRoots {
169 private:
170 const bool _is_par;
171 public:
172 ShenandoahThreadRoots(bool is_par);
173 ~ShenandoahThreadRoots();
174
175 void oops_do(OopClosure* oops_cl, CodeBlobClosure* code_cl, uint worker_id);
176 void threads_do(ThreadClosure* tc, uint worker_id);
177 };
178
179 class ShenandoahStringDedupRoots {
180 public:
181 ShenandoahStringDedupRoots();
182 ~ShenandoahStringDedupRoots();
183
184 void oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
185 };
186
187 template <typename ITR>
188 class ShenandoahCodeCacheRoots {
189 private:
190 ITR _coderoots_iterator;
191 public:
192 ShenandoahCodeCacheRoots();
193 ~ShenandoahCodeCacheRoots();
194
195 void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
196 };
197
198 class ShenandoahClassLoaderDataRoots {
231
232 // Apply oops, clds and blobs to all strongly reachable roots and weakly reachable
233 // roots when class unloading is disabled during this cycle
234 void roots_do(uint worker_id, OopClosure* cl);
235 void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
236 // For heap object iteration
237 void roots_do_unchecked(OopClosure* cl);
238 void strong_roots_do_unchecked(OopClosure* cl);
239 };
240
241 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
242 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
243
244 // Evacuate all roots at a safepoint
245 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
246 private:
247 ShenandoahSerialRoots _serial_roots;
248 ShenandoahJNIHandleRoots<> _jni_roots;
249 ShenandoahClassLoaderDataRoots _cld_roots;
250 ShenandoahThreadRoots _thread_roots;
251 ShenandoahSerialWeakRoots _serial_weak_roots;
252 ShenandoahWeakRoots<> _weak_roots;
253 ShenandoahStringDedupRoots _dedup_roots;
254 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
255 bool _include_concurrent_roots;
256
257 public:
258 ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
259
260 void roots_do(uint worker_id, OopClosure* oops);
261 };
262
263 // Update all roots at a safepoint
264 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
265 private:
266 ShenandoahSerialRoots _serial_roots;
267 ShenandoahJNIHandleRoots<> _jni_roots;
268 ShenandoahClassLoaderDataRoots _cld_roots;
269 ShenandoahThreadRoots _thread_roots;
270 ShenandoahSerialWeakRoots _serial_weak_roots;
271 ShenandoahWeakRoots<> _weak_roots;
272 ShenandoahStringDedupRoots _dedup_roots;
273 ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
274 const bool _update_code_cache;
275
276 public:
277 ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
278
279 template<typename IsAlive, typename KeepAlive>
280 void roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive);
281 };
282
283 // Adjuster all roots at a safepoint during full gc
284 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
285 private:
286 ShenandoahSerialRoots _serial_roots;
287 ShenandoahJNIHandleRoots<> _jni_roots;
288 ShenandoahClassLoaderDataRoots _cld_roots;
289 ShenandoahThreadRoots _thread_roots;
290 ShenandoahSerialWeakRoots _serial_weak_roots;
291 ShenandoahWeakRoots<> _weak_roots;
292 ShenandoahStringDedupRoots _dedup_roots;
293 ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
294
295 public:
296 ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
297
298 void roots_do(uint worker_id, OopClosure* oops);
299 };
300
301 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_HPP
|