< prev index next >

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

Print this page




 157 
 158       int iter = 0;
 159       do {
 160         iter++;
 161         if (!cm()->has_aborted()) {
 162           G1ConcPhaseTimer t(_cm, "Concurrent Mark From Roots");
 163           _cm->mark_from_roots();
 164         }
 165 
 166         double mark_end_time = os::elapsedVTime();
 167         jlong mark_end = os::elapsed_counter();
 168         _vtime_mark_accum += (mark_end_time - cycle_start);
 169         if (!cm()->has_aborted()) {
 170           delay_to_keep_mmu(g1_policy, true /* remark */);
 171           log_info(gc, marking)("Concurrent Mark (%.3fs, %.3fs) %.3fms",
 172                                 TimeHelper::counter_to_seconds(mark_start),
 173                                 TimeHelper::counter_to_seconds(mark_end),
 174                                 TimeHelper::counter_to_millis(mark_end - mark_start));
 175 
 176           CMCheckpointRootsFinalClosure final_cl(_cm);
 177           VM_CGC_Operation op(&final_cl, "Pause Remark", true /* needs_pll */);
 178           VMThread::execute(&op);
 179         }
 180         if (cm()->restart_for_overflow()) {
 181           log_debug(gc, marking)("Restarting Concurrent Marking because of Mark Stack Overflow in Remark (Iteration #%d).", iter);
 182           log_info(gc, marking)("Concurrent Mark Restart due to overflow");
 183         }
 184       } while (cm()->restart_for_overflow());
 185 
 186       double end_time = os::elapsedVTime();
 187       // Update the total virtual time before doing this, since it will try
 188       // to measure it to get the vtime for this marking.  We purposely
 189       // neglect the presumably-short "completeCleanup" phase here.
 190       _vtime_accum = (end_time - _vtime_start);
 191 
 192       if (!cm()->has_aborted()) {
 193         delay_to_keep_mmu(g1_policy, false /* cleanup */);
 194 
 195         CMCleanUp cl_cl(_cm);
 196         VM_CGC_Operation op(&cl_cl, "Pause Cleanup", false /* needs_pll */);
 197         VMThread::execute(&op);
 198       } else {
 199         // We don't want to update the marking status if a GC pause
 200         // is already underway.
 201         SuspendibleThreadSetJoiner sts_join;
 202         g1h->collector_state()->set_mark_in_progress(false);
 203       }
 204 
 205       // Check if cleanup set the free_regions_coming flag. If it
 206       // hasn't, we can just skip the next step.
 207       if (g1h->free_regions_coming()) {
 208         // The following will finish freeing up any regions that we
 209         // found to be empty during cleanup. We'll do this part
 210         // without joining the suspendible set. If an evacuation pause
 211         // takes place, then we would carry on freeing regions in
 212         // case they are needed by the pause. If a Full GC takes
 213         // place, it would wait for us to process the regions
 214         // reclaimed by cleanup.
 215 
 216         G1ConcPhaseTimer t(_cm, "Concurrent Complete Cleanup");




 157 
 158       int iter = 0;
 159       do {
 160         iter++;
 161         if (!cm()->has_aborted()) {
 162           G1ConcPhaseTimer t(_cm, "Concurrent Mark From Roots");
 163           _cm->mark_from_roots();
 164         }
 165 
 166         double mark_end_time = os::elapsedVTime();
 167         jlong mark_end = os::elapsed_counter();
 168         _vtime_mark_accum += (mark_end_time - cycle_start);
 169         if (!cm()->has_aborted()) {
 170           delay_to_keep_mmu(g1_policy, true /* remark */);
 171           log_info(gc, marking)("Concurrent Mark (%.3fs, %.3fs) %.3fms",
 172                                 TimeHelper::counter_to_seconds(mark_start),
 173                                 TimeHelper::counter_to_seconds(mark_end),
 174                                 TimeHelper::counter_to_millis(mark_end - mark_start));
 175 
 176           CMCheckpointRootsFinalClosure final_cl(_cm);
 177           VM_CGC_Operation op(&final_cl, "Pause Remark");
 178           VMThread::execute(&op);
 179         }
 180         if (cm()->restart_for_overflow()) {
 181           log_debug(gc, marking)("Restarting Concurrent Marking because of Mark Stack Overflow in Remark (Iteration #%d).", iter);
 182           log_info(gc, marking)("Concurrent Mark Restart due to overflow");
 183         }
 184       } while (cm()->restart_for_overflow());
 185 
 186       double end_time = os::elapsedVTime();
 187       // Update the total virtual time before doing this, since it will try
 188       // to measure it to get the vtime for this marking.  We purposely
 189       // neglect the presumably-short "completeCleanup" phase here.
 190       _vtime_accum = (end_time - _vtime_start);
 191 
 192       if (!cm()->has_aborted()) {
 193         delay_to_keep_mmu(g1_policy, false /* cleanup */);
 194 
 195         CMCleanUp cl_cl(_cm);
 196         VM_CGC_Operation op(&cl_cl, "Pause Cleanup");
 197         VMThread::execute(&op);
 198       } else {
 199         // We don't want to update the marking status if a GC pause
 200         // is already underway.
 201         SuspendibleThreadSetJoiner sts_join;
 202         g1h->collector_state()->set_mark_in_progress(false);
 203       }
 204 
 205       // Check if cleanup set the free_regions_coming flag. If it
 206       // hasn't, we can just skip the next step.
 207       if (g1h->free_regions_coming()) {
 208         // The following will finish freeing up any regions that we
 209         // found to be empty during cleanup. We'll do this part
 210         // without joining the suspendible set. If an evacuation pause
 211         // takes place, then we would carry on freeing regions in
 212         // case they are needed by the pause. If a Full GC takes
 213         // place, it would wait for us to process the regions
 214         // reclaimed by cleanup.
 215 
 216         G1ConcPhaseTimer t(_cm, "Concurrent Complete Cleanup");


< prev index next >