< prev index next >

src/hotspot/share/gc/z/zRootsIterator.cpp

Print this page




 142 private:
 143   BarrierSetNMethod* _bs;
 144 
 145 public:
 146   ZRootsIteratorCodeBlobClosure(OopClosure* cl) :
 147     CodeBlobToOopClosure(cl, true /* fix_relocations */),
 148     _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {}
 149 
 150   virtual void do_code_blob(CodeBlob* cb) {
 151     nmethod* const nm = cb->as_nmethod_or_null();
 152     if (nm != NULL && !nm->test_set_oops_do_mark()) {
 153       CodeBlobToOopClosure::do_code_blob(cb);
 154       _bs->disarm(nm);
 155     }
 156   }
 157 };
 158 
 159 class ZRootsIteratorThreadClosure : public ThreadClosure {
 160 private:
 161   ZRootsIteratorClosure* _cl;
 162   const bool             _visit_invisible;
 163 
 164 public:
 165   ZRootsIteratorThreadClosure(ZRootsIteratorClosure* cl, bool visit_invisible) :
 166       _cl(cl),
 167       _visit_invisible(visit_invisible) {}
 168 
 169   virtual void do_thread(Thread* thread) {
 170     ZRootsIteratorCodeBlobClosure code_cl(_cl);
 171     thread->oops_do(_cl, ClassUnloading ? &code_cl : NULL);
 172     _cl->do_thread(thread);
 173     if (_visit_invisible && ZThreadLocalData::has_invisible_root(thread)) {
 174       _cl->do_oop(ZThreadLocalData::invisible_root(thread));
 175     }
 176   }
 177 };
 178 
 179 ZRootsIterator::ZRootsIterator(bool visit_invisible, bool visit_jvmti_weak_export) :
 180     _visit_invisible(visit_invisible),
 181     _visit_jvmti_weak_export(visit_jvmti_weak_export),
 182     _universe(this),
 183     _object_synchronizer(this),
 184     _management(this),
 185     _jvmti_export(this),
 186     _jvmti_weak_export(this),
 187     _system_dictionary(this),
 188     _threads(this),
 189     _code_cache(this) {
 190   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
 191   ZStatTimer timer(ZSubPhasePauseRootsSetup);
 192   Threads::change_thread_claim_token();
 193   COMPILER2_PRESENT(DerivedPointerTable::clear());
 194   if (ClassUnloading) {
 195     nmethod::oops_do_marking_prologue();
 196   } else {
 197     ZNMethod::oops_do_begin();
 198   }
 199 }
 200 


 229 void ZRootsIterator::do_jvmti_export(ZRootsIteratorClosure* cl) {
 230   ZStatTimer timer(ZSubPhasePauseRootsJVMTIExport);
 231   JvmtiExport::oops_do(cl);
 232 }
 233 
 234 void ZRootsIterator::do_jvmti_weak_export(ZRootsIteratorClosure* cl) {
 235   ZStatTimer timer(ZSubPhasePauseRootsJVMTIWeakExport);
 236   AlwaysTrueClosure always_alive;
 237   JvmtiExport::weak_oops_do(&always_alive, cl);
 238 }
 239 
 240 void ZRootsIterator::do_system_dictionary(ZRootsIteratorClosure* cl) {
 241   ZStatTimer timer(ZSubPhasePauseRootsSystemDictionary);
 242   // Handles are processed via _vm_handles.
 243   SystemDictionary::oops_do(cl, false /* include_handles */);
 244 }
 245 
 246 void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
 247   ZStatTimer timer(ZSubPhasePauseRootsThreads);
 248   ResourceMark rm;
 249   ZRootsIteratorThreadClosure thread_cl(cl, _visit_invisible);
 250   Threads::possibly_parallel_threads_do(true, &thread_cl);
 251 }
 252 
 253 void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
 254   ZStatTimer timer(ZSubPhasePauseRootsCodeCache);
 255   ZNMethod::oops_do(cl);
 256 }
 257 
 258 void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
 259   ZStatTimer timer(ZSubPhasePauseRoots);
 260   _universe.oops_do(cl);
 261   _object_synchronizer.oops_do(cl);
 262   _management.oops_do(cl);
 263   _jvmti_export.oops_do(cl);
 264   _system_dictionary.oops_do(cl);
 265   _threads.oops_do(cl);
 266   if (!ClassUnloading) {
 267     _code_cache.oops_do(cl);
 268   }
 269   if (_visit_jvmti_weak_export) {




 142 private:
 143   BarrierSetNMethod* _bs;
 144 
 145 public:
 146   ZRootsIteratorCodeBlobClosure(OopClosure* cl) :
 147     CodeBlobToOopClosure(cl, true /* fix_relocations */),
 148     _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {}
 149 
 150   virtual void do_code_blob(CodeBlob* cb) {
 151     nmethod* const nm = cb->as_nmethod_or_null();
 152     if (nm != NULL && !nm->test_set_oops_do_mark()) {
 153       CodeBlobToOopClosure::do_code_blob(cb);
 154       _bs->disarm(nm);
 155     }
 156   }
 157 };
 158 
 159 class ZRootsIteratorThreadClosure : public ThreadClosure {
 160 private:
 161   ZRootsIteratorClosure* _cl;

 162 
 163 public:
 164   ZRootsIteratorThreadClosure(ZRootsIteratorClosure* cl) :
 165       _cl(cl) {}

 166 
 167   virtual void do_thread(Thread* thread) {
 168     ZRootsIteratorCodeBlobClosure code_cl(_cl);
 169     thread->oops_do(_cl, ClassUnloading ? &code_cl : NULL);
 170     _cl->do_thread(thread);



 171   }
 172 };
 173 
 174 ZRootsIterator::ZRootsIterator(bool visit_jvmti_weak_export) :

 175     _visit_jvmti_weak_export(visit_jvmti_weak_export),
 176     _universe(this),
 177     _object_synchronizer(this),
 178     _management(this),
 179     _jvmti_export(this),
 180     _jvmti_weak_export(this),
 181     _system_dictionary(this),
 182     _threads(this),
 183     _code_cache(this) {
 184   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
 185   ZStatTimer timer(ZSubPhasePauseRootsSetup);
 186   Threads::change_thread_claim_token();
 187   COMPILER2_PRESENT(DerivedPointerTable::clear());
 188   if (ClassUnloading) {
 189     nmethod::oops_do_marking_prologue();
 190   } else {
 191     ZNMethod::oops_do_begin();
 192   }
 193 }
 194 


 223 void ZRootsIterator::do_jvmti_export(ZRootsIteratorClosure* cl) {
 224   ZStatTimer timer(ZSubPhasePauseRootsJVMTIExport);
 225   JvmtiExport::oops_do(cl);
 226 }
 227 
 228 void ZRootsIterator::do_jvmti_weak_export(ZRootsIteratorClosure* cl) {
 229   ZStatTimer timer(ZSubPhasePauseRootsJVMTIWeakExport);
 230   AlwaysTrueClosure always_alive;
 231   JvmtiExport::weak_oops_do(&always_alive, cl);
 232 }
 233 
 234 void ZRootsIterator::do_system_dictionary(ZRootsIteratorClosure* cl) {
 235   ZStatTimer timer(ZSubPhasePauseRootsSystemDictionary);
 236   // Handles are processed via _vm_handles.
 237   SystemDictionary::oops_do(cl, false /* include_handles */);
 238 }
 239 
 240 void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
 241   ZStatTimer timer(ZSubPhasePauseRootsThreads);
 242   ResourceMark rm;
 243   ZRootsIteratorThreadClosure thread_cl(cl);
 244   Threads::possibly_parallel_threads_do(true, &thread_cl);
 245 }
 246 
 247 void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
 248   ZStatTimer timer(ZSubPhasePauseRootsCodeCache);
 249   ZNMethod::oops_do(cl);
 250 }
 251 
 252 void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
 253   ZStatTimer timer(ZSubPhasePauseRoots);
 254   _universe.oops_do(cl);
 255   _object_synchronizer.oops_do(cl);
 256   _management.oops_do(cl);
 257   _jvmti_export.oops_do(cl);
 258   _system_dictionary.oops_do(cl);
 259   _threads.oops_do(cl);
 260   if (!ClassUnloading) {
 261     _code_cache.oops_do(cl);
 262   }
 263   if (_visit_jvmti_weak_export) {


< prev index next >