157 }; |
157 }; |
158 |
158 |
159 class ZRootsIteratorThreadClosure : public ThreadClosure { |
159 class ZRootsIteratorThreadClosure : public ThreadClosure { |
160 private: |
160 private: |
161 ZRootsIteratorClosure* _cl; |
161 ZRootsIteratorClosure* _cl; |
162 const bool _visit_invisible; |
|
163 |
162 |
164 public: |
163 public: |
165 ZRootsIteratorThreadClosure(ZRootsIteratorClosure* cl, bool visit_invisible) : |
164 ZRootsIteratorThreadClosure(ZRootsIteratorClosure* cl) : |
166 _cl(cl), |
165 _cl(cl) {} |
167 _visit_invisible(visit_invisible) {} |
|
168 |
166 |
169 virtual void do_thread(Thread* thread) { |
167 virtual void do_thread(Thread* thread) { |
170 ZRootsIteratorCodeBlobClosure code_cl(_cl); |
168 ZRootsIteratorCodeBlobClosure code_cl(_cl); |
171 thread->oops_do(_cl, ClassUnloading ? &code_cl : NULL); |
169 thread->oops_do(_cl, ClassUnloading ? &code_cl : NULL); |
172 _cl->do_thread(thread); |
170 _cl->do_thread(thread); |
173 if (_visit_invisible && ZThreadLocalData::has_invisible_root(thread)) { |
|
174 _cl->do_oop(ZThreadLocalData::invisible_root(thread)); |
|
175 } |
|
176 } |
171 } |
177 }; |
172 }; |
178 |
173 |
179 ZRootsIterator::ZRootsIterator(bool visit_invisible, bool visit_jvmti_weak_export) : |
174 ZRootsIterator::ZRootsIterator(bool visit_jvmti_weak_export) : |
180 _visit_invisible(visit_invisible), |
|
181 _visit_jvmti_weak_export(visit_jvmti_weak_export), |
175 _visit_jvmti_weak_export(visit_jvmti_weak_export), |
182 _universe(this), |
176 _universe(this), |
183 _object_synchronizer(this), |
177 _object_synchronizer(this), |
184 _management(this), |
178 _management(this), |
185 _jvmti_export(this), |
179 _jvmti_export(this), |
244 } |
238 } |
245 |
239 |
246 void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) { |
240 void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) { |
247 ZStatTimer timer(ZSubPhasePauseRootsThreads); |
241 ZStatTimer timer(ZSubPhasePauseRootsThreads); |
248 ResourceMark rm; |
242 ResourceMark rm; |
249 ZRootsIteratorThreadClosure thread_cl(cl, _visit_invisible); |
243 ZRootsIteratorThreadClosure thread_cl(cl); |
250 Threads::possibly_parallel_threads_do(true, &thread_cl); |
244 Threads::possibly_parallel_threads_do(true, &thread_cl); |
251 } |
245 } |
252 |
246 |
253 void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) { |
247 void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) { |
254 ZStatTimer timer(ZSubPhasePauseRootsCodeCache); |
248 ZStatTimer timer(ZSubPhasePauseRootsCodeCache); |