19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 #ifndef SHARE_GC_Z_ZROOTSITERATOR_HPP
25 #define SHARE_GC_Z_ZROOTSITERATOR_HPP
26
27 #include "gc/shared/oopStorageParState.hpp"
28 #include "gc/shared/oopStorageSetParState.hpp"
29 #include "gc/shared/suspendibleThreadSet.hpp"
30 #include "memory/allocation.hpp"
31 #include "memory/iterator.hpp"
32 #include "runtime/thread.hpp"
33 #include "runtime/threadSMR.hpp"
34 #include "utilities/globalDefinitions.hpp"
35
36 class ZRootsIteratorClosure;
37
38 typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator;
39 typedef OopStorageSetStrongParState<true /* concurrent */, false /* is_const */> ZOopStorageSetIterator;
40
41 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
42 class ZSerialOopsDo {
43 private:
44 T* const _iter;
45 volatile bool _claimed;
46
47 public:
48 ZSerialOopsDo(T* iter);
49 void oops_do(ZRootsIteratorClosure* cl);
50 };
51
52 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
53 class ZParallelOopsDo {
54 private:
55 T* const _iter;
56 volatile bool _completed;
57
58 public:
59 ZParallelOopsDo(T* iter);
119 void do_code_cache(ZRootsIteratorClosure* cl);
120
121 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe;
122 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer;
123 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management;
124 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export;
125 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
126 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_vm_thread> _vm_thread;
127 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_java_threads> _java_threads;
128 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache;
129
130 public:
131 ZRootsIterator(bool visit_jvmti_weak_export = false);
132 ~ZRootsIterator();
133
134 void oops_do(ZRootsIteratorClosure* cl);
135 };
136
137 class ZConcurrentRootsIterator {
138 private:
139 ZOopStorageSetIterator _oop_storage_set_iter;
140 const int _cld_claim;
141
142 void do_oop_storage_set(ZRootsIteratorClosure* cl);
143 void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
144
145 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_oop_storage_set> _oop_storage_set;
146 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_class_loader_data_graph> _class_loader_data_graph;
147
148 public:
149 ZConcurrentRootsIterator(int cld_claim);
150 ~ZConcurrentRootsIterator();
151
152 void oops_do(ZRootsIteratorClosure* cl);
153 };
154
155 class ZConcurrentRootsIteratorClaimStrong : public ZConcurrentRootsIterator {
156 public:
157 ZConcurrentRootsIteratorClaimStrong() :
158 ZConcurrentRootsIterator(ClassLoaderData::_claim_strong) {}
159 };
160
171 };
172
173 class ZWeakRootsIterator {
174 private:
175 void do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
176 void do_jfr_weak(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
177
178 ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
179 ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jfr_weak> _jfr_weak;
180
181 public:
182 ZWeakRootsIterator();
183 ~ZWeakRootsIterator();
184
185 void weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
186 void oops_do(ZRootsIteratorClosure* cl);
187 };
188
189 class ZConcurrentWeakRootsIterator {
190 private:
191 ZOopStorageIterator _vm_weak_handles_iter;
192 ZOopStorageIterator _jni_weak_handles_iter;
193 ZOopStorageIterator _string_table_iter;
194 ZOopStorageIterator _resolved_method_table_iter;
195
196 void do_vm_weak_handles(ZRootsIteratorClosure* cl);
197 void do_jni_weak_handles(ZRootsIteratorClosure* cl);
198 void do_string_table(ZRootsIteratorClosure* cl);
199 void do_resolved_method_table(ZRootsIteratorClosure* cl);
200
201 ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_vm_weak_handles> _vm_weak_handles;
202 ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_jni_weak_handles> _jni_weak_handles;
203 ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_string_table> _string_table;
204 ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_resolved_method_table> _resolved_method_table;
205
206 public:
207 ZConcurrentWeakRootsIterator();
208 ~ZConcurrentWeakRootsIterator();
209
210 void oops_do(ZRootsIteratorClosure* cl);
211 };
212
213 #endif // SHARE_GC_Z_ZROOTSITERATOR_HPP
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 #ifndef SHARE_GC_Z_ZROOTSITERATOR_HPP
25 #define SHARE_GC_Z_ZROOTSITERATOR_HPP
26
27 #include "gc/shared/oopStorageParState.hpp"
28 #include "gc/shared/oopStorageSetParState.hpp"
29 #include "gc/shared/suspendibleThreadSet.hpp"
30 #include "memory/allocation.hpp"
31 #include "memory/iterator.hpp"
32 #include "runtime/thread.hpp"
33 #include "runtime/threadSMR.hpp"
34 #include "utilities/globalDefinitions.hpp"
35
36 class ZRootsIteratorClosure;
37
38 typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator;
39 typedef OopStorageSetStrongParState<true /* concurrent */, false /* is_const */> ZOopStorageSetStrongIterator;
40 typedef OopStorageSetWeakParState<true /* concurrent */, false /* is_const */> ZOopStorageSetWeakIterator;
41
42 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
43 class ZSerialOopsDo {
44 private:
45 T* const _iter;
46 volatile bool _claimed;
47
48 public:
49 ZSerialOopsDo(T* iter);
50 void oops_do(ZRootsIteratorClosure* cl);
51 };
52
53 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
54 class ZParallelOopsDo {
55 private:
56 T* const _iter;
57 volatile bool _completed;
58
59 public:
60 ZParallelOopsDo(T* iter);
120 void do_code_cache(ZRootsIteratorClosure* cl);
121
122 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe;
123 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer;
124 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management;
125 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export;
126 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
127 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_vm_thread> _vm_thread;
128 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_java_threads> _java_threads;
129 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache;
130
131 public:
132 ZRootsIterator(bool visit_jvmti_weak_export = false);
133 ~ZRootsIterator();
134
135 void oops_do(ZRootsIteratorClosure* cl);
136 };
137
138 class ZConcurrentRootsIterator {
139 private:
140 ZOopStorageSetStrongIterator _oop_storage_set_iter;
141 const int _cld_claim;
142
143 void do_oop_storage_set(ZRootsIteratorClosure* cl);
144 void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
145
146 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_oop_storage_set> _oop_storage_set;
147 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_class_loader_data_graph> _class_loader_data_graph;
148
149 public:
150 ZConcurrentRootsIterator(int cld_claim);
151 ~ZConcurrentRootsIterator();
152
153 void oops_do(ZRootsIteratorClosure* cl);
154 };
155
156 class ZConcurrentRootsIteratorClaimStrong : public ZConcurrentRootsIterator {
157 public:
158 ZConcurrentRootsIteratorClaimStrong() :
159 ZConcurrentRootsIterator(ClassLoaderData::_claim_strong) {}
160 };
161
172 };
173
174 class ZWeakRootsIterator {
175 private:
176 void do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
177 void do_jfr_weak(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
178
179 ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
180 ZSerialWeakOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jfr_weak> _jfr_weak;
181
182 public:
183 ZWeakRootsIterator();
184 ~ZWeakRootsIterator();
185
186 void weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
187 void oops_do(ZRootsIteratorClosure* cl);
188 };
189
190 class ZConcurrentWeakRootsIterator {
191 private:
192 ZOopStorageSetWeakIterator _oop_storage_set_iter;
193
194 void do_oop_storage_set(ZRootsIteratorClosure* cl);
195
196 ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_oop_storage_set> _oop_storage_set;
197
198 public:
199 ZConcurrentWeakRootsIterator();
200
201 void oops_do(ZRootsIteratorClosure* cl);
202
203 void notify();
204 };
205
206 #endif // SHARE_GC_Z_ZROOTSITERATOR_HPP
|