< prev index next >

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

Print this page

 63 static const ZStatSubPhase ZSubPhasePauseRootsManagement("Pause Roots Management");
 64 static const ZStatSubPhase ZSubPhasePauseRootsJVMTIExport("Pause Roots JVMTIExport");
 65 static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport");
 66 static const ZStatSubPhase ZSubPhasePauseRootsVMThread("Pause Roots VM Thread");
 67 static const ZStatSubPhase ZSubPhasePauseRootsJavaThreads("Pause Roots Java Threads");
 68 static const ZStatSubPhase ZSubPhasePauseRootsCodeCache("Pause Roots CodeCache");
 69 
 70 static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup");
 71 static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots");
 72 static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown");
 73 static const ZStatSubPhase ZSubPhaseConcurrentRootsOopStorageSet("Concurrent Roots OopStorageSet");
 74 static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph");
 75 
 76 static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup");
 77 static const ZStatSubPhase ZSubPhasePauseWeakRoots("Pause Weak Roots");
 78 static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
 79 static const ZStatSubPhase ZSubPhasePauseWeakRootsJVMTIWeakExport("Pause Weak Roots JVMTIWeakExport");
 80 static const ZStatSubPhase ZSubPhasePauseWeakRootsJFRWeak("Pause Weak Roots JFRWeak");
 81 
 82 static const ZStatSubPhase ZSubPhaseConcurrentWeakRoots("Concurrent Weak Roots");
 83 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsVMWeakHandles("Concurrent Weak Roots VMWeakHandles");
 84 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsJNIWeakHandles("Concurrent Weak Roots JNIWeakHandles");
 85 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsStringTable("Concurrent Weak Roots StringTable");
 86 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsResolvedMethodTable("Concurrent Weak Roots ResolvedMethodTable");
 87 
 88 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 89 ZSerialOopsDo<T, F>::ZSerialOopsDo(T* iter) :
 90     _iter(iter),
 91     _claimed(false) {}
 92 
 93 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 94 void ZSerialOopsDo<T, F>::oops_do(ZRootsIteratorClosure* cl) {
 95   if (!_claimed && Atomic::cmpxchg(&_claimed, false, true) == false) {
 96     (_iter->*F)(cl);
 97   }
 98 }
 99 
100 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
101 ZParallelOopsDo<T, F>::ZParallelOopsDo(T* iter) :
102     _iter(iter),
103     _completed(false) {}
104 
105 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
106 void ZParallelOopsDo<T, F>::oops_do(ZRootsIteratorClosure* cl) {

332 
333 void ZWeakRootsIterator::do_jfr_weak(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
334 #if INCLUDE_JFR
335   ZStatTimer timer(ZSubPhasePauseWeakRootsJFRWeak);
336   Jfr::weak_oops_do(is_alive, cl);
337 #endif
338 }
339 
340 void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
341   ZStatTimer timer(ZSubPhasePauseWeakRoots);
342   _jvmti_weak_export.weak_oops_do(is_alive, cl);
343   _jfr_weak.weak_oops_do(is_alive, cl);
344 }
345 
346 void ZWeakRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
347   AlwaysTrueClosure always_alive;
348   weak_oops_do(&always_alive, cl);
349 }
350 
351 ZConcurrentWeakRootsIterator::ZConcurrentWeakRootsIterator() :
352     _vm_weak_handles_iter(OopStorageSet::vm_weak()),
353     _jni_weak_handles_iter(OopStorageSet::jni_weak()),
354     _string_table_iter(OopStorageSet::string_table_weak()),
355     _resolved_method_table_iter(OopStorageSet::resolved_method_table_weak()),
356     _vm_weak_handles(this),
357     _jni_weak_handles(this),
358     _string_table(this),
359     _resolved_method_table(this) {
360   StringTable::reset_dead_counter();
361   ResolvedMethodTable::reset_dead_counter();
362 }
363 
364 ZConcurrentWeakRootsIterator::~ZConcurrentWeakRootsIterator() {
365   StringTable::finish_dead_counter();
366   ResolvedMethodTable::finish_dead_counter();
367 }
368 
369 void ZConcurrentWeakRootsIterator::do_vm_weak_handles(ZRootsIteratorClosure* cl) {
370   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsVMWeakHandles);
371   _vm_weak_handles_iter.oops_do(cl);
372 }
373 
374 void ZConcurrentWeakRootsIterator::do_jni_weak_handles(ZRootsIteratorClosure* cl) {
375   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsJNIWeakHandles);
376   _jni_weak_handles_iter.oops_do(cl);
377 }
378 
379 template <class Container>
380 class ZDeadCounterClosure : public ZRootsIteratorClosure  {
381 private:
382   ZRootsIteratorClosure* const _cl;
383   size_t                       _ndead;
384 
385 public:
386   ZDeadCounterClosure(ZRootsIteratorClosure* cl) :
387       _cl(cl),
388       _ndead(0) {}
389 
390   ~ZDeadCounterClosure() {
391     Container::inc_dead_counter(_ndead);
392   }
393 
394   virtual void do_oop(oop* p) {
395     _cl->do_oop(p);
396     if (*p == NULL) {
397       _ndead++;
398     }
399   }
400 
401   virtual void do_oop(narrowOop* p) {
402     ShouldNotReachHere();
403   }
404 };
405 
406 void ZConcurrentWeakRootsIterator::do_string_table(ZRootsIteratorClosure* cl) {
407   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsStringTable);
408   ZDeadCounterClosure<StringTable> counter_cl(cl);
409   _string_table_iter.oops_do(&counter_cl);
410 }
411 
412 void ZConcurrentWeakRootsIterator::do_resolved_method_table(ZRootsIteratorClosure* cl) {
413   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsResolvedMethodTable);
414   ZDeadCounterClosure<ResolvedMethodTable> counter_cl(cl);
415   _resolved_method_table_iter.oops_do(&counter_cl);
416 }
417 
418 void ZConcurrentWeakRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
419   ZStatTimer timer(ZSubPhaseConcurrentWeakRoots);
420   _vm_weak_handles.oops_do(cl);
421   _jni_weak_handles.oops_do(cl);
422   _string_table.oops_do(cl);
423   _resolved_method_table.oops_do(cl);
424 }

 63 static const ZStatSubPhase ZSubPhasePauseRootsManagement("Pause Roots Management");
 64 static const ZStatSubPhase ZSubPhasePauseRootsJVMTIExport("Pause Roots JVMTIExport");
 65 static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport");
 66 static const ZStatSubPhase ZSubPhasePauseRootsVMThread("Pause Roots VM Thread");
 67 static const ZStatSubPhase ZSubPhasePauseRootsJavaThreads("Pause Roots Java Threads");
 68 static const ZStatSubPhase ZSubPhasePauseRootsCodeCache("Pause Roots CodeCache");
 69 
 70 static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup");
 71 static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots");
 72 static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown");
 73 static const ZStatSubPhase ZSubPhaseConcurrentRootsOopStorageSet("Concurrent Roots OopStorageSet");
 74 static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph");
 75 
 76 static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup");
 77 static const ZStatSubPhase ZSubPhasePauseWeakRoots("Pause Weak Roots");
 78 static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
 79 static const ZStatSubPhase ZSubPhasePauseWeakRootsJVMTIWeakExport("Pause Weak Roots JVMTIWeakExport");
 80 static const ZStatSubPhase ZSubPhasePauseWeakRootsJFRWeak("Pause Weak Roots JFRWeak");
 81 
 82 static const ZStatSubPhase ZSubPhaseConcurrentWeakRoots("Concurrent Weak Roots");
 83 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsOopStorageSet("Concurrent Weak Roots OopStorageSet");



 84 
 85 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 86 ZSerialOopsDo<T, F>::ZSerialOopsDo(T* iter) :
 87     _iter(iter),
 88     _claimed(false) {}
 89 
 90 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 91 void ZSerialOopsDo<T, F>::oops_do(ZRootsIteratorClosure* cl) {
 92   if (!_claimed && Atomic::cmpxchg(&_claimed, false, true) == false) {
 93     (_iter->*F)(cl);
 94   }
 95 }
 96 
 97 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
 98 ZParallelOopsDo<T, F>::ZParallelOopsDo(T* iter) :
 99     _iter(iter),
100     _completed(false) {}
101 
102 template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
103 void ZParallelOopsDo<T, F>::oops_do(ZRootsIteratorClosure* cl) {

329 
330 void ZWeakRootsIterator::do_jfr_weak(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
331 #if INCLUDE_JFR
332   ZStatTimer timer(ZSubPhasePauseWeakRootsJFRWeak);
333   Jfr::weak_oops_do(is_alive, cl);
334 #endif
335 }
336 
337 void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl) {
338   ZStatTimer timer(ZSubPhasePauseWeakRoots);
339   _jvmti_weak_export.weak_oops_do(is_alive, cl);
340   _jfr_weak.weak_oops_do(is_alive, cl);
341 }
342 
343 void ZWeakRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
344   AlwaysTrueClosure always_alive;
345   weak_oops_do(&always_alive, cl);
346 }
347 
348 ZConcurrentWeakRootsIterator::ZConcurrentWeakRootsIterator() :
349     _oop_storage_set_iter(),
350     _oop_storage_set(this) {


















351 }
352 
353 void ZConcurrentWeakRootsIterator::notify() {
354   _oop_storage_set_iter.notify();

355 }
356 
357 void ZConcurrentWeakRootsIterator::do_oop_storage_set(ZRootsIteratorClosure* cl) {
358   ZStatTimer timer(ZSubPhaseConcurrentWeakRootsOopStorageSet);
359   _oop_storage_set_iter.oops_do(cl);


































360 }
361 
362 void ZConcurrentWeakRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
363   ZStatTimer timer(ZSubPhaseConcurrentWeakRoots);
364   _oop_storage_set.oops_do(cl);



365 }
< prev index next >