hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
changeset 14077 a7060dec741b
parent 13969 d2a189b83b87
parent 14076 84643cfaeaa8
child 14123 944e56f74fba
equal deleted inserted replaced
14072:11606bd0741b 14077:a7060dec741b
  2393 
  2393 
  2394   HandleMark hm;  // Discard invalid handles created during verification
  2394   HandleMark hm;  // Discard invalid handles created during verification
  2395 
  2395 
  2396   if (VerifyBeforeGC &&
  2396   if (VerifyBeforeGC &&
  2397       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2397       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2398     Universe::verify(true);
  2398     Universe::verify();
  2399   }
  2399   }
  2400 
  2400 
  2401   // Snapshot the soft reference policy to be used in this collection cycle.
  2401   // Snapshot the soft reference policy to be used in this collection cycle.
  2402   ref_processor()->setup_policy(clear_all_soft_refs);
  2402   ref_processor()->setup_policy(clear_all_soft_refs);
  2403 
  2403 
  2417       case Marking:
  2417       case Marking:
  2418         // initial marking in checkpointRootsInitialWork has been completed
  2418         // initial marking in checkpointRootsInitialWork has been completed
  2419         if (VerifyDuringGC &&
  2419         if (VerifyDuringGC &&
  2420             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2420             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2421           gclog_or_tty->print("Verify before initial mark: ");
  2421           gclog_or_tty->print("Verify before initial mark: ");
  2422           Universe::verify(true);
  2422           Universe::verify();
  2423         }
  2423         }
  2424         {
  2424         {
  2425           bool res = markFromRoots(false);
  2425           bool res = markFromRoots(false);
  2426           assert(res && _collectorState == FinalMarking, "Collector state should "
  2426           assert(res && _collectorState == FinalMarking, "Collector state should "
  2427             "have changed");
  2427             "have changed");
  2429         }
  2429         }
  2430       case FinalMarking:
  2430       case FinalMarking:
  2431         if (VerifyDuringGC &&
  2431         if (VerifyDuringGC &&
  2432             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2432             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2433           gclog_or_tty->print("Verify before re-mark: ");
  2433           gclog_or_tty->print("Verify before re-mark: ");
  2434           Universe::verify(true);
  2434           Universe::verify();
  2435         }
  2435         }
  2436         checkpointRootsFinal(false, clear_all_soft_refs,
  2436         checkpointRootsFinal(false, clear_all_soft_refs,
  2437                              init_mark_was_synchronous);
  2437                              init_mark_was_synchronous);
  2438         assert(_collectorState == Sweeping, "Collector state should not "
  2438         assert(_collectorState == Sweeping, "Collector state should not "
  2439           "have changed within checkpointRootsFinal()");
  2439           "have changed within checkpointRootsFinal()");
  2441       case Sweeping:
  2441       case Sweeping:
  2442         // final marking in checkpointRootsFinal has been completed
  2442         // final marking in checkpointRootsFinal has been completed
  2443         if (VerifyDuringGC &&
  2443         if (VerifyDuringGC &&
  2444             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2444             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2445           gclog_or_tty->print("Verify before sweep: ");
  2445           gclog_or_tty->print("Verify before sweep: ");
  2446           Universe::verify(true);
  2446           Universe::verify();
  2447         }
  2447         }
  2448         sweep(false);
  2448         sweep(false);
  2449         assert(_collectorState == Resizing, "Incorrect state");
  2449         assert(_collectorState == Resizing, "Incorrect state");
  2450         break;
  2450         break;
  2451       case Resizing: {
  2451       case Resizing: {
  2457       case Resetting:
  2457       case Resetting:
  2458         // The heap has been resized.
  2458         // The heap has been resized.
  2459         if (VerifyDuringGC &&
  2459         if (VerifyDuringGC &&
  2460             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2460             GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2461           gclog_or_tty->print("Verify before reset: ");
  2461           gclog_or_tty->print("Verify before reset: ");
  2462           Universe::verify(true);
  2462           Universe::verify();
  2463         }
  2463         }
  2464         reset(false);
  2464         reset(false);
  2465         assert(_collectorState == Idling, "Collector state should "
  2465         assert(_collectorState == Idling, "Collector state should "
  2466           "have changed");
  2466           "have changed");
  2467         break;
  2467         break;
  2484     size_policy()->ms_collection_end(gch->gc_cause());
  2484     size_policy()->ms_collection_end(gch->gc_cause());
  2485   }
  2485   }
  2486 
  2486 
  2487   if (VerifyAfterGC &&
  2487   if (VerifyAfterGC &&
  2488       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2488       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  2489     Universe::verify(true);
  2489     Universe::verify();
  2490   }
  2490   }
  2491   if (TraceCMSState) {
  2491   if (TraceCMSState) {
  2492     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
  2492     gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
  2493       " exiting collection CMS state %d",
  2493       " exiting collection CMS state %d",
  2494       Thread::current(), _collectorState);
  2494       Thread::current(), _collectorState);
  5666     }
  5666     }
  5667   }
  5667   }
  5668   if (VerifyDuringGC &&
  5668   if (VerifyDuringGC &&
  5669       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  5669       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  5670     HandleMark hm;  // Discard invalid handles created during verification
  5670     HandleMark hm;  // Discard invalid handles created during verification
  5671     Universe::verify(true);
  5671     Universe::verify();
  5672   }
  5672   }
  5673   {
  5673   {
  5674     TraceTime t("root rescan", PrintGCDetails, false, gclog_or_tty);
  5674     TraceTime t("root rescan", PrintGCDetails, false, gclog_or_tty);
  5675 
  5675 
  5676     verify_work_stacks_empty();
  5676     verify_work_stacks_empty();