Print this page
Abort concurrent mark

@@ -154,11 +154,11 @@
     {
       ResourceMark rm;
       HandleMark   hm;
       double cycle_start = os::elapsedVTime();
 
-      {
+      if (!_cm->aborted_by_initial_mark()) {
         G1ConcPhaseTimer p(_cm, "Concurrent Clear Claimed Marks");
         ClassLoaderDataGraph::clear_claimed_marks();
       }
 
       // We have to ensure that we finish scanning the root regions

@@ -167,11 +167,11 @@
       // have been scanned. If we did then it's possible that a
       // subsequent GC could block us from joining the STS and proceed
       // without the root regions have been scanned which would be a
       // correctness issue.
 
-      {
+      if (!_cm->aborted_by_initial_mark()) {
         G1ConcPhaseTimer p(_cm, "Concurrent Scan Root Regions");
         _cm->scan_root_regions();
       }
 
       // Note: ConcurrentGCBreakpoints before here risk deadlock,

@@ -180,12 +180,14 @@
       // It would be nice to use the G1ConcPhaseTimer class here but
       // the "end" logging is inside the loop and not at the end of
       // a scope. Also, the timer doesn't support nesting.
       // Mimicking the same log output instead.
       jlong mark_start = os::elapsed_counter();
+      if (!_cm->aborted_by_initial_mark()) {
       log_info(gc, marking)("Concurrent Mark (%.3fs)",
                             TimeHelper::counter_to_seconds(mark_start));
+      }
       for (uint iter = 1; !_cm->has_aborted(); ++iter) {
         // Concurrent marking.
         {
           ConcurrentGCBreakpoints::at("AFTER MARKING STARTED");
           G1ConcPhaseTimer p(_cm, "Concurrent Mark From Roots");

@@ -254,11 +256,12 @@
 
       // We now want to allow clearing of the marking bitmap to be
       // suspended by a collection pause.
       // We may have aborted just before the remark. Do not bother clearing the
       // bitmap then, as it has been done during mark abort.
-      if (!_cm->has_aborted()) {
+      if (!_cm->aborted_by_fullgc()) {
+        // We still need to cleanup bitmap if aborted by initial mark
         G1ConcPhaseTimer p(_cm, "Concurrent Cleanup for Next Mark");
         _cm->cleanup_for_next_mark();
       }
     }