< prev index next >

src/hotspot/share/gc/g1/g1FullCollector.cpp

Print this page




 135   }
 136   FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
 137   FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
 138 }
 139 
 140 void G1FullCollector::prepare_collection() {
 141   _heap->policy()->record_full_collection_start();
 142 
 143   _heap->print_heap_before_gc();
 144   _heap->print_heap_regions();
 145 
 146   _heap->abort_concurrent_cycle();
 147   _heap->verify_before_full_collection(scope()->is_explicit_gc());
 148 
 149   _heap->gc_prologue(true);
 150   _heap->prepare_heap_for_full_collection();
 151 
 152   reference_processor()->enable_discovery();
 153   reference_processor()->setup_policy(scope()->should_clear_soft_refs());
 154 
 155   // When collecting the permanent generation Method*s may be moving,
 156   // so we either have to flush all bcp data or convert it into bci.
 157   CodeCache::gc_prologue();
 158 
 159   // We should save the marks of the currently locked biased monitors.
 160   // The marking doesn't preserve the marks of biased objects.
 161   BiasedLocking::preserve_marks();
 162 
 163   // Clear and activate derived pointer collection.
 164   clear_and_activate_derived_pointers();
 165 }
 166 
 167 void G1FullCollector::collect() {
 168   phase1_mark_live_objects();
 169   verify_after_marking();
 170 
 171   // Don't add any more derived pointers during later phases
 172   deactivate_derived_pointers();
 173 
 174   phase2_prepare_compaction();
 175 
 176   phase3_adjust_pointers();
 177 
 178   phase4_do_compaction();
 179 }
 180 
 181 void G1FullCollector::complete_collection() {
 182   // Restore all marks.
 183   restore_marks();
 184 
 185   // When the pointers have been adjusted and moved, we can
 186   // update the derived pointer table.
 187   update_derived_pointers();
 188 
 189   BiasedLocking::restore_marks();
 190   CodeCache::gc_epilogue();
 191   JvmtiExport::gc_epilogue();
 192 
 193   _heap->prepare_heap_for_mutators();
 194 
 195   _heap->policy()->record_full_collection_end();
 196   _heap->gc_epilogue(true);
 197 
 198   _heap->verify_after_full_collection();
 199 
 200   _heap->print_heap_after_full_collection(scope()->heap_transition());
 201 }
 202 
 203 void G1FullCollector::phase1_mark_live_objects() {
 204   // Recursively traverse all live objects and mark them.
 205   GCTraceTime(Info, gc, phases) info("Phase 1: Mark live objects", scope()->timer());
 206 
 207   // Do the actual marking.
 208   G1FullGCMarkTask marking_task(this);
 209   run_task(&marking_task);
 210 




 135   }
 136   FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers);
 137   FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points);
 138 }
 139 
 140 void G1FullCollector::prepare_collection() {
 141   _heap->policy()->record_full_collection_start();
 142 
 143   _heap->print_heap_before_gc();
 144   _heap->print_heap_regions();
 145 
 146   _heap->abort_concurrent_cycle();
 147   _heap->verify_before_full_collection(scope()->is_explicit_gc());
 148 
 149   _heap->gc_prologue(true);
 150   _heap->prepare_heap_for_full_collection();
 151 
 152   reference_processor()->enable_discovery();
 153   reference_processor()->setup_policy(scope()->should_clear_soft_refs());
 154 




 155   // We should save the marks of the currently locked biased monitors.
 156   // The marking doesn't preserve the marks of biased objects.
 157   BiasedLocking::preserve_marks();
 158 
 159   // Clear and activate derived pointer collection.
 160   clear_and_activate_derived_pointers();
 161 }
 162 
 163 void G1FullCollector::collect() {
 164   phase1_mark_live_objects();
 165   verify_after_marking();
 166 
 167   // Don't add any more derived pointers during later phases
 168   deactivate_derived_pointers();
 169 
 170   phase2_prepare_compaction();
 171 
 172   phase3_adjust_pointers();
 173 
 174   phase4_do_compaction();
 175 }
 176 
 177 void G1FullCollector::complete_collection() {
 178   // Restore all marks.
 179   restore_marks();
 180 
 181   // When the pointers have been adjusted and moved, we can
 182   // update the derived pointer table.
 183   update_derived_pointers();
 184 
 185   BiasedLocking::restore_marks();

 186   JvmtiExport::gc_epilogue();
 187 
 188   _heap->prepare_heap_for_mutators();
 189 
 190   _heap->policy()->record_full_collection_end();
 191   _heap->gc_epilogue(true);
 192 
 193   _heap->verify_after_full_collection();
 194 
 195   _heap->print_heap_after_full_collection(scope()->heap_transition());
 196 }
 197 
 198 void G1FullCollector::phase1_mark_live_objects() {
 199   // Recursively traverse all live objects and mark them.
 200   GCTraceTime(Info, gc, phases) info("Phase 1: Mark live objects", scope()->timer());
 201 
 202   // Do the actual marking.
 203   G1FullGCMarkTask marking_task(this);
 204   run_task(&marking_task);
 205 


< prev index next >