hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
changeset 17112 e49af4ba7755
parent 17106 1ac17c50420a
child 17114 b341b4c63384
equal deleted inserted replaced
17111:77f553b98e63 17112:e49af4ba7755
  2442         break;
  2442         break;
  2443       case Marking:
  2443       case Marking:
  2444         // initial marking in checkpointRootsInitialWork has been completed
  2444         // initial marking in checkpointRootsInitialWork has been completed
  2445         if (VerifyDuringGC &&
  2445         if (VerifyDuringGC &&
  2446             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2446             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2447           gclog_or_tty->print("Verify before initial mark: ");
  2447           Universe::verify("Verify before initial mark: ");
  2448           Universe::verify();
       
  2449         }
  2448         }
  2450         {
  2449         {
  2451           bool res = markFromRoots(false);
  2450           bool res = markFromRoots(false);
  2452           assert(res && _collectorState == FinalMarking, "Collector state should "
  2451           assert(res && _collectorState == FinalMarking, "Collector state should "
  2453             "have changed");
  2452             "have changed");
  2454           break;
  2453           break;
  2455         }
  2454         }
  2456       case FinalMarking:
  2455       case FinalMarking:
  2457         if (VerifyDuringGC &&
  2456         if (VerifyDuringGC &&
  2458             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2457             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2459           gclog_or_tty->print("Verify before re-mark: ");
  2458           Universe::verify("Verify before re-mark: ");
  2460           Universe::verify();
       
  2461         }
  2459         }
  2462         checkpointRootsFinal(false, clear_all_soft_refs,
  2460         checkpointRootsFinal(false, clear_all_soft_refs,
  2463                              init_mark_was_synchronous);
  2461                              init_mark_was_synchronous);
  2464         assert(_collectorState == Sweeping, "Collector state should not "
  2462         assert(_collectorState == Sweeping, "Collector state should not "
  2465           "have changed within checkpointRootsFinal()");
  2463           "have changed within checkpointRootsFinal()");
  2466         break;
  2464         break;
  2467       case Sweeping:
  2465       case Sweeping:
  2468         // final marking in checkpointRootsFinal has been completed
  2466         // final marking in checkpointRootsFinal has been completed
  2469         if (VerifyDuringGC &&
  2467         if (VerifyDuringGC &&
  2470             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2468             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2471           gclog_or_tty->print("Verify before sweep: ");
  2469           Universe::verify("Verify before sweep: ");
  2472           Universe::verify();
       
  2473         }
  2470         }
  2474         sweep(false);
  2471         sweep(false);
  2475         assert(_collectorState == Resizing, "Incorrect state");
  2472         assert(_collectorState == Resizing, "Incorrect state");
  2476         break;
  2473         break;
  2477       case Resizing: {
  2474       case Resizing: {
  2482       }
  2479       }
  2483       case Resetting:
  2480       case Resetting:
  2484         // The heap has been resized.
  2481         // The heap has been resized.
  2485         if (VerifyDuringGC &&
  2482         if (VerifyDuringGC &&
  2486             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2483             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2487           gclog_or_tty->print("Verify before reset: ");
  2484           Universe::verify("Verify before reset: ");
  2488           Universe::verify();
       
  2489         }
  2485         }
  2490         reset(false);
  2486         reset(false);
  2491         assert(_collectorState == Idling, "Collector state should "
  2487         assert(_collectorState == Idling, "Collector state should "
  2492           "have changed");
  2488           "have changed");
  2493         break;
  2489         break;
  2851   }
  2847   }
  2852 
  2848 
  2853   bool failed() { return _failed; }
  2849   bool failed() { return _failed; }
  2854 };
  2850 };
  2855 
  2851 
  2856 bool CMSCollector::verify_after_remark() {
  2852 bool CMSCollector::verify_after_remark(bool silent) {
  2857   gclog_or_tty->print(" [Verifying CMS Marking... ");
  2853   if (!silent) gclog_or_tty->print(" [Verifying CMS Marking... ");
  2858   MutexLockerEx ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
  2854   MutexLockerEx ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
  2859   static bool init = false;
  2855   static bool init = false;
  2860 
  2856 
  2861   assert(SafepointSynchronize::is_at_safepoint(),
  2857   assert(SafepointSynchronize::is_at_safepoint(),
  2862          "Else mutations in object graph will make answer suspect");
  2858          "Else mutations in object graph will make answer suspect");
  2913     verify_after_remark_work_2();
  2909     verify_after_remark_work_2();
  2914   } else {
  2910   } else {
  2915     warning("Unrecognized value %d for CMSRemarkVerifyVariant",
  2911     warning("Unrecognized value %d for CMSRemarkVerifyVariant",
  2916             CMSRemarkVerifyVariant);
  2912             CMSRemarkVerifyVariant);
  2917   }
  2913   }
  2918   gclog_or_tty->print(" done] ");
  2914   if (!silent) gclog_or_tty->print(" done] ");
  2919   return true;
  2915   return true;
  2920 }
  2916 }
  2921 
  2917 
  2922 void CMSCollector::verify_after_remark_work_1() {
  2918 void CMSCollector::verify_after_remark_work_1() {
  2923   ResourceMark rm;
  2919   ResourceMark rm;