src/share/vm/gc_implementation/g1/concurrentMark.cpp

Print this page
rev 6446 : 8040807: G1: Enable G1CollectedHeap::stop()
Reviewed-by: TBD


 883 
 884   // Repeat the asserts from above.
 885   guarantee(cmThread()->during_cycle(), "invariant");
 886   guarantee(!g1h->mark_in_progress(), "invariant");
 887 }
 888 
 889 class NoteStartOfMarkHRClosure: public HeapRegionClosure {
 890 public:
 891   bool doHeapRegion(HeapRegion* r) {
 892     if (!r->continuesHumongous()) {
 893       r->note_start_of_marking();
 894     }
 895     return false;
 896   }
 897 };
 898 
 899 void ConcurrentMark::checkpointRootsInitialPre() {
 900   G1CollectedHeap*   g1h = G1CollectedHeap::heap();
 901   G1CollectorPolicy* g1p = g1h->g1_policy();
 902 
 903   _has_aborted = false;
 904 
 905 #ifndef PRODUCT
 906   if (G1PrintReachableAtInitialMark) {
 907     print_reachable("at-cycle-start",
 908                     VerifyOption_G1UsePrevMarking, true /* all */);
 909   }
 910 #endif
 911 
 912   // Initialize marking structures. This has to be done in a STW phase.
 913   reset();
 914 
 915   // For each region note start of marking.
 916   NoteStartOfMarkHRClosure startcl;
 917   g1h->heap_region_iterate(&startcl);
 918 }
 919 
 920 
 921 void ConcurrentMark::checkpointRootsInitialPost() {
 922   G1CollectedHeap*   g1h = G1CollectedHeap::heap();
 923 


3243 }
3244 
3245 // abandon current marking iteration due to a Full GC
3246 void ConcurrentMark::abort() {
3247   // Clear all marks to force marking thread to do nothing
3248   _nextMarkBitMap->clearAll();
3249 
3250   // Note we cannot clear the previous marking bitmap here
3251   // since VerifyDuringGC verifies the objects marked during
3252   // a full GC against the previous bitmap.
3253 
3254   // Clear the liveness counting data
3255   clear_all_count_data();
3256   // Empty mark stack
3257   reset_marking_state();
3258   for (uint i = 0; i < _max_worker_id; ++i) {
3259     _tasks[i]->clear_region_fields();
3260   }
3261   _first_overflow_barrier_sync.abort();
3262   _second_overflow_barrier_sync.abort();
3263   _has_aborted = true;
3264 
3265   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
3266   satb_mq_set.abandon_partial_marking();
3267   // This can be called either during or outside marking, we'll read
3268   // the expected_active value from the SATB queue set.
3269   satb_mq_set.set_active_all_threads(
3270                                  false, /* new active value */
3271                                  satb_mq_set.is_active() /* expected_active */);
3272 
3273   _g1h->trace_heap_after_concurrent_cycle();
3274   _g1h->register_concurrent_cycle_end();
3275 }
3276 
3277 static void print_ms_time_info(const char* prefix, const char* name,
3278                                NumberSeq& ns) {
3279   gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).",
3280                          prefix, ns.num(), name, ns.sum()/1000.0, ns.avg());
3281   if (ns.num() > 0) {
3282     gclog_or_tty->print_cr("%s         [std. dev = %8.2f ms, max = %8.2f ms]",
3283                            prefix, ns.sd(), ns.maximum());




 883 
 884   // Repeat the asserts from above.
 885   guarantee(cmThread()->during_cycle(), "invariant");
 886   guarantee(!g1h->mark_in_progress(), "invariant");
 887 }
 888 
 889 class NoteStartOfMarkHRClosure: public HeapRegionClosure {
 890 public:
 891   bool doHeapRegion(HeapRegion* r) {
 892     if (!r->continuesHumongous()) {
 893       r->note_start_of_marking();
 894     }
 895     return false;
 896   }
 897 };
 898 
 899 void ConcurrentMark::checkpointRootsInitialPre() {
 900   G1CollectedHeap*   g1h = G1CollectedHeap::heap();
 901   G1CollectorPolicy* g1p = g1h->g1_policy();
 902 
 903   clear_has_aborted();
 904 
 905 #ifndef PRODUCT
 906   if (G1PrintReachableAtInitialMark) {
 907     print_reachable("at-cycle-start",
 908                     VerifyOption_G1UsePrevMarking, true /* all */);
 909   }
 910 #endif
 911 
 912   // Initialize marking structures. This has to be done in a STW phase.
 913   reset();
 914 
 915   // For each region note start of marking.
 916   NoteStartOfMarkHRClosure startcl;
 917   g1h->heap_region_iterate(&startcl);
 918 }
 919 
 920 
 921 void ConcurrentMark::checkpointRootsInitialPost() {
 922   G1CollectedHeap*   g1h = G1CollectedHeap::heap();
 923 


3243 }
3244 
3245 // abandon current marking iteration due to a Full GC
3246 void ConcurrentMark::abort() {
3247   // Clear all marks to force marking thread to do nothing
3248   _nextMarkBitMap->clearAll();
3249 
3250   // Note we cannot clear the previous marking bitmap here
3251   // since VerifyDuringGC verifies the objects marked during
3252   // a full GC against the previous bitmap.
3253 
3254   // Clear the liveness counting data
3255   clear_all_count_data();
3256   // Empty mark stack
3257   reset_marking_state();
3258   for (uint i = 0; i < _max_worker_id; ++i) {
3259     _tasks[i]->clear_region_fields();
3260   }
3261   _first_overflow_barrier_sync.abort();
3262   _second_overflow_barrier_sync.abort();
3263   set_has_aborted();
3264 
3265   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
3266   satb_mq_set.abandon_partial_marking();
3267   // This can be called either during or outside marking, we'll read
3268   // the expected_active value from the SATB queue set.
3269   satb_mq_set.set_active_all_threads(
3270                                  false, /* new active value */
3271                                  satb_mq_set.is_active() /* expected_active */);
3272 
3273   _g1h->trace_heap_after_concurrent_cycle();
3274   _g1h->register_concurrent_cycle_end();
3275 }
3276 
3277 static void print_ms_time_info(const char* prefix, const char* name,
3278                                NumberSeq& ns) {
3279   gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).",
3280                          prefix, ns.num(), name, ns.sum()/1000.0, ns.avg());
3281   if (ns.num() > 0) {
3282     gclog_or_tty->print_cr("%s         [std. dev = %8.2f ms, max = %8.2f ms]",
3283                            prefix, ns.sd(), ns.maximum());