< prev index next >

src/share/vm/gc/g1/g1MarkSweep.cpp

Print this page




  76 
  77   GenMarkSweep::set_ref_processor(rp);
  78   rp->setup_policy(clear_all_softrefs);
  79 
  80   // When collecting the permanent generation Method*s may be moving,
  81   // so we either have to flush all bcp data or convert it into bci.
  82   CodeCache::gc_prologue();
  83 
  84   bool marked_for_unloading = false;
  85 
  86   allocate_stacks();
  87 
  88   // We should save the marks of the currently locked biased monitors.
  89   // The marking doesn't preserve the marks of biased objects.
  90   BiasedLocking::preserve_marks();
  91 
  92   mark_sweep_phase1(marked_for_unloading, clear_all_softrefs);
  93 
  94   mark_sweep_phase2();
  95 

  96   // Don't add any more derived pointers during phase3
  97   COMPILER2_PRESENT(DerivedPointerTable::set_active(false));

  98 
  99   mark_sweep_phase3();
 100 
 101   mark_sweep_phase4();
 102 
 103   GenMarkSweep::restore_marks();
 104   BiasedLocking::restore_marks();
 105   GenMarkSweep::deallocate_stacks();
 106 
 107   CodeCache::gc_epilogue();
 108   JvmtiExport::gc_epilogue();
 109 
 110   // refs processing: clean slate
 111   GenMarkSweep::set_ref_processor(NULL);
 112 }
 113 
 114 
 115 void G1MarkSweep::allocate_stacks() {
 116   GenMarkSweep::_preserved_count_max = 0;
 117   GenMarkSweep::_preserved_marks = NULL;


 151   gc_tracer()->report_gc_reference_stats(stats);
 152 
 153 
 154   // This is the point where the entire marking should have completed.
 155   assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
 156 
 157   // Unload classes and purge the SystemDictionary.
 158   bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
 159 
 160   // Unload nmethods.
 161   CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class);
 162 
 163   // Prune dead klasses from subklass/sibling/implementor lists.
 164   Klass::clean_weak_klass_links(&GenMarkSweep::is_alive);
 165 
 166   // Delete entries for dead interned string and clean up unreferenced symbols in symbol table.
 167   g1h->unlink_string_and_symbol_table(&GenMarkSweep::is_alive);
 168 
 169   if (VerifyDuringGC) {
 170     HandleMark hm;  // handle scope
 171     COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);


 172     g1h->prepare_for_verify();
 173     // Note: we can verify only the heap here. When an object is
 174     // marked, the previous value of the mark word (including
 175     // identity hash values, ages, etc) is preserved, and the mark
 176     // word is set to markOop::marked_value - effectively removing
 177     // any hash values from the mark word. These hash values are
 178     // used when verifying the dictionaries and so removing them
 179     // from the mark word can make verification of the dictionaries
 180     // fail. At the end of the GC, the original mark word values
 181     // (including hash values) are restored to the appropriate
 182     // objects.
 183     if (!VerifySilently) {
 184       gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
 185     }
 186     g1h->verify(VerifySilently, VerifyOption_G1UseMarkWord);
 187     if (!VerifySilently) {
 188       gclog_or_tty->print_cr("]");
 189     }
 190   }
 191 




  76 
  77   GenMarkSweep::set_ref_processor(rp);
  78   rp->setup_policy(clear_all_softrefs);
  79 
  80   // When collecting the permanent generation Method*s may be moving,
  81   // so we either have to flush all bcp data or convert it into bci.
  82   CodeCache::gc_prologue();
  83 
  84   bool marked_for_unloading = false;
  85 
  86   allocate_stacks();
  87 
  88   // We should save the marks of the currently locked biased monitors.
  89   // The marking doesn't preserve the marks of biased objects.
  90   BiasedLocking::preserve_marks();
  91 
  92   mark_sweep_phase1(marked_for_unloading, clear_all_softrefs);
  93 
  94   mark_sweep_phase2();
  95 
  96 #if defined(COMPILER2) || INCLUDE_JVMCI
  97   // Don't add any more derived pointers during phase3
  98   DerivedPointerTable::set_active(false);
  99 #endif
 100 
 101   mark_sweep_phase3();
 102 
 103   mark_sweep_phase4();
 104 
 105   GenMarkSweep::restore_marks();
 106   BiasedLocking::restore_marks();
 107   GenMarkSweep::deallocate_stacks();
 108 
 109   CodeCache::gc_epilogue();
 110   JvmtiExport::gc_epilogue();
 111 
 112   // refs processing: clean slate
 113   GenMarkSweep::set_ref_processor(NULL);
 114 }
 115 
 116 
 117 void G1MarkSweep::allocate_stacks() {
 118   GenMarkSweep::_preserved_count_max = 0;
 119   GenMarkSweep::_preserved_marks = NULL;


 153   gc_tracer()->report_gc_reference_stats(stats);
 154 
 155 
 156   // This is the point where the entire marking should have completed.
 157   assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
 158 
 159   // Unload classes and purge the SystemDictionary.
 160   bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
 161 
 162   // Unload nmethods.
 163   CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class);
 164 
 165   // Prune dead klasses from subklass/sibling/implementor lists.
 166   Klass::clean_weak_klass_links(&GenMarkSweep::is_alive);
 167 
 168   // Delete entries for dead interned string and clean up unreferenced symbols in symbol table.
 169   g1h->unlink_string_and_symbol_table(&GenMarkSweep::is_alive);
 170 
 171   if (VerifyDuringGC) {
 172     HandleMark hm;  // handle scope
 173 #if defined(COMPILER2) || INCLUDE_JVMCI
 174     DerivedPointerTableDeactivate dpt_deact;
 175 #endif
 176     g1h->prepare_for_verify();
 177     // Note: we can verify only the heap here. When an object is
 178     // marked, the previous value of the mark word (including
 179     // identity hash values, ages, etc) is preserved, and the mark
 180     // word is set to markOop::marked_value - effectively removing
 181     // any hash values from the mark word. These hash values are
 182     // used when verifying the dictionaries and so removing them
 183     // from the mark word can make verification of the dictionaries
 184     // fail. At the end of the GC, the original mark word values
 185     // (including hash values) are restored to the appropriate
 186     // objects.
 187     if (!VerifySilently) {
 188       gclog_or_tty->print(" VerifyDuringGC:(full)[Verifying ");
 189     }
 190     g1h->verify(VerifySilently, VerifyOption_G1UseMarkWord);
 191     if (!VerifySilently) {
 192       gclog_or_tty->print_cr("]");
 193     }
 194   }
 195 


< prev index next >