src/hotspot/share/gc/z/zRootsIterator.cpp
changeset 51405 8b23aa7cef47
parent 50875 2217b2fc29ea
child 51587 b459c731901b
equal deleted inserted replaced
51404:c5461fe16efb 51405:8b23aa7cef47
    22  */
    22  */
    23 
    23 
    24 #include "precompiled.hpp"
    24 #include "precompiled.hpp"
    25 #include "classfile/classLoaderData.hpp"
    25 #include "classfile/classLoaderData.hpp"
    26 #include "classfile/stringTable.hpp"
    26 #include "classfile/stringTable.hpp"
    27 #include "classfile/symbolTable.hpp"
       
    28 #include "classfile/systemDictionary.hpp"
    27 #include "classfile/systemDictionary.hpp"
    29 #include "code/codeCache.hpp"
    28 #include "code/codeCache.hpp"
    30 #include "compiler/oopMap.hpp"
    29 #include "compiler/oopMap.hpp"
    31 #include "gc/shared/oopStorageParState.inline.hpp"
    30 #include "gc/shared/oopStorageParState.inline.hpp"
    32 #include "gc/z/zGlobals.hpp"
    31 #include "gc/z/zGlobals.hpp"
    72 static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
    71 static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
    73 static const ZStatSubPhase ZSubPhasePauseWeakRootsVMWeakHandles("Pause Weak Roots VMWeakHandles");
    72 static const ZStatSubPhase ZSubPhasePauseWeakRootsVMWeakHandles("Pause Weak Roots VMWeakHandles");
    74 static const ZStatSubPhase ZSubPhasePauseWeakRootsJNIWeakHandles("Pause Weak Roots JNIWeakHandles");
    73 static const ZStatSubPhase ZSubPhasePauseWeakRootsJNIWeakHandles("Pause Weak Roots JNIWeakHandles");
    75 static const ZStatSubPhase ZSubPhasePauseWeakRootsJVMTIWeakExport("Pause Weak Roots JVMTIWeakExport");
    74 static const ZStatSubPhase ZSubPhasePauseWeakRootsJVMTIWeakExport("Pause Weak Roots JVMTIWeakExport");
    76 static const ZStatSubPhase ZSubPhasePauseWeakRootsJFRWeak("Pause Weak Roots JFRWeak");
    75 static const ZStatSubPhase ZSubPhasePauseWeakRootsJFRWeak("Pause Weak Roots JFRWeak");
    77 static const ZStatSubPhase ZSubPhasePauseWeakRootsSymbolTable("Pause Weak Roots SymbolTable");
       
    78 static const ZStatSubPhase ZSubPhasePauseWeakRootsStringTable("Pause Weak Roots StringTable");
    76 static const ZStatSubPhase ZSubPhasePauseWeakRootsStringTable("Pause Weak Roots StringTable");
    79 
    77 
    80 static const ZStatSubPhase ZSubPhaseConcurrentWeakRoots("Concurrent Weak Roots");
    78 static const ZStatSubPhase ZSubPhaseConcurrentWeakRoots("Concurrent Weak Roots");
    81 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsVMWeakHandles("Concurrent Weak Roots VMWeakHandles");
    79 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsVMWeakHandles("Concurrent Weak Roots VMWeakHandles");
    82 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsJNIWeakHandles("Concurrent Weak Roots JNIWeakHandles");
    80 static const ZStatSubPhase ZSubPhaseConcurrentWeakRootsJNIWeakHandles("Concurrent Weak Roots JNIWeakHandles");
   300     _string_table_iter(StringTable::weak_storage()),
   298     _string_table_iter(StringTable::weak_storage()),
   301     _jvmti_weak_export(this),
   299     _jvmti_weak_export(this),
   302     _jfr_weak(this),
   300     _jfr_weak(this),
   303     _vm_weak_handles(this),
   301     _vm_weak_handles(this),
   304     _jni_weak_handles(this),
   302     _jni_weak_handles(this),
   305     _symbol_table(this),
       
   306     _string_table(this) {
   303     _string_table(this) {
   307   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
   304   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
   308   ZStatTimer timer(ZSubPhasePauseWeakRootsSetup);
   305   ZStatTimer timer(ZSubPhasePauseWeakRootsSetup);
   309   SymbolTable::clear_parallel_claimed_index();
       
   310   StringTable::reset_dead_counter();
   306   StringTable::reset_dead_counter();
   311 }
   307 }
   312 
   308 
   313 ZWeakRootsIterator::~ZWeakRootsIterator() {
   309 ZWeakRootsIterator::~ZWeakRootsIterator() {
   314   ZStatTimer timer(ZSubPhasePauseWeakRootsTeardown);
   310   ZStatTimer timer(ZSubPhasePauseWeakRootsTeardown);
   335   ZStatTimer timer(ZSubPhasePauseWeakRootsJFRWeak);
   331   ZStatTimer timer(ZSubPhasePauseWeakRootsJFRWeak);
   336   Jfr::weak_oops_do(is_alive, cl);
   332   Jfr::weak_oops_do(is_alive, cl);
   337 #endif
   333 #endif
   338 }
   334 }
   339 
   335 
   340 void ZWeakRootsIterator::do_symbol_table(BoolObjectClosure* is_alive, OopClosure* cl) {
       
   341   ZStatTimer timer(ZSubPhasePauseWeakRootsSymbolTable);
       
   342   int dummy;
       
   343   SymbolTable::possibly_parallel_unlink(&dummy, &dummy);
       
   344 }
       
   345 
       
   346 class ZStringTableDeadCounterBoolObjectClosure : public BoolObjectClosure  {
   336 class ZStringTableDeadCounterBoolObjectClosure : public BoolObjectClosure  {
   347 private:
   337 private:
   348   BoolObjectClosure* const _cl;
   338   BoolObjectClosure* const _cl;
   349   size_t                   _ndead;
   339   size_t                   _ndead;
   350 
   340 
   373   _string_table_iter.weak_oops_do(&counter_is_alive, cl);
   363   _string_table_iter.weak_oops_do(&counter_is_alive, cl);
   374 }
   364 }
   375 
   365 
   376 void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl) {
   366 void ZWeakRootsIterator::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* cl) {
   377   ZStatTimer timer(ZSubPhasePauseWeakRoots);
   367   ZStatTimer timer(ZSubPhasePauseWeakRoots);
   378   if (ZSymbolTableUnloading) {
       
   379     _symbol_table.weak_oops_do(is_alive, cl);
       
   380   }
       
   381   if (ZWeakRoots) {
   368   if (ZWeakRoots) {
   382     _jvmti_weak_export.weak_oops_do(is_alive, cl);
   369     _jvmti_weak_export.weak_oops_do(is_alive, cl);
   383     _jfr_weak.weak_oops_do(is_alive, cl);
   370     _jfr_weak.weak_oops_do(is_alive, cl);
   384     if (!ZConcurrentVMWeakHandles) {
   371     if (!ZConcurrentVMWeakHandles) {
   385       _vm_weak_handles.weak_oops_do(is_alive, cl);
   372       _vm_weak_handles.weak_oops_do(is_alive, cl);