< prev index next >

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

Print this page

        

@@ -121,10 +121,11 @@
 
   while (!_should_terminate) {
     // wait until started is set.
     sleepBeforeNextCycle();
     if (_should_terminate) {
+      _cm->root_regions()->cancel_scan();
       break;
     }
 
     assert(GCId::current() != GCId::undefined(), "GC id should have been set up by the initial mark GC.");
     {

@@ -138,11 +139,12 @@
       // 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()->has_aborted()) {
+      if (_cm->root_regions()->scan_in_progress()) {
+        assert(!cm()->has_aborted(), "Aborting before root region scanning is finished not supported.");
         GCConcPhaseTimer(_cm, "Concurrent Root Region Scanning");
         _cm->scanRootRegions();
       }
 
       // It would be nice to use the GCTraceConcTime class here but
< prev index next >