src/hotspot/share/gc/z/zRootsIterator.cpp
changeset 55603 3868dde58ebb
parent 54511 fbfcebad8e66
child 55605 91050b1e0fe8
equal deleted inserted replaced
55602:73395f9cad54 55603:3868dde58ebb
   261   if (visit_jvmti_weak_export) {
   261   if (visit_jvmti_weak_export) {
   262     _jvmti_weak_export.oops_do(cl);
   262     _jvmti_weak_export.oops_do(cl);
   263   }
   263   }
   264 }
   264 }
   265 
   265 
   266 ZConcurrentRootsIterator::ZConcurrentRootsIterator(bool marking) :
   266 ZConcurrentRootsIterator::ZConcurrentRootsIterator(int cld_claim) :
   267     _marking(marking),
       
   268     _sts_joiner(marking /* active */),
       
   269     _jni_handles_iter(JNIHandles::global_handles()),
   267     _jni_handles_iter(JNIHandles::global_handles()),
       
   268     _cld_claim(cld_claim),
   270     _jni_handles(this),
   269     _jni_handles(this),
   271     _class_loader_data_graph(this) {
   270     _class_loader_data_graph(this) {
   272   ZStatTimer timer(ZSubPhaseConcurrentRootsSetup);
   271   ZStatTimer timer(ZSubPhaseConcurrentRootsSetup);
   273   if (_marking) {
       
   274     ClassLoaderDataGraph_lock->lock();
       
   275     ClassLoaderDataGraph::clear_claimed_marks();
       
   276   }
       
   277 }
   272 }
   278 
   273 
   279 ZConcurrentRootsIterator::~ZConcurrentRootsIterator() {
   274 ZConcurrentRootsIterator::~ZConcurrentRootsIterator() {
   280   ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown);
   275   ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown);
   281   if (_marking) {
       
   282     ClassLoaderDataGraph_lock->unlock();
       
   283   }
       
   284 }
   276 }
   285 
   277 
   286 void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
   278 void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
   287   ZStatTimer timer(ZSubPhaseConcurrentRootsJNIHandles);
   279   ZStatTimer timer(ZSubPhaseConcurrentRootsJNIHandles);
   288   _jni_handles_iter.oops_do(cl);
   280   _jni_handles_iter.oops_do(cl);
   289 }
   281 }
   290 
   282 
   291 void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
   283 void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
   292   ZStatTimer timer(ZSubPhaseConcurrentRootsClassLoaderDataGraph);
   284   ZStatTimer timer(ZSubPhaseConcurrentRootsClassLoaderDataGraph);
   293   if (_marking) {
   285   CLDToOopClosure cld_cl(cl, _cld_claim);
   294     CLDToOopClosure cld_cl(cl, ClassLoaderData::_claim_strong);
   286   ClassLoaderDataGraph::always_strong_cld_do(&cld_cl);
   295     ClassLoaderDataGraph::always_strong_cld_do(&cld_cl);
       
   296   } else {
       
   297     CLDToOopClosure cld_cl(cl, ClassLoaderData::_claim_none);
       
   298     ClassLoaderDataGraph::cld_do(&cld_cl);
       
   299   }
       
   300 }
   287 }
   301 
   288 
   302 void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
   289 void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
   303   ZStatTimer timer(ZSubPhaseConcurrentRoots);
   290   ZStatTimer timer(ZSubPhaseConcurrentRoots);
   304   _jni_handles.oops_do(cl);
   291   _jni_handles.oops_do(cl);