comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 20190:0982ec23da03

8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps Reviewed-by: jwilhelm, ehelin, tschatzl
author brutisso
date Thu, 19 Jun 2014 13:31:14 +0200
parents 8e20ef014b08
children ce8f6bb717c9
comparison
equal deleted inserted replaced
20189:5d855d021755 20190:0982ec23da03
1997 gc_timer->register_gc_start(); 1997 gc_timer->register_gc_start();
1998 1998
1999 SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer(); 1999 SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
2000 gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start()); 2000 gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
2001 2001
2002 GCTraceTime t("CMS:MSC ", PrintGCDetails && Verbose, true, NULL); 2002 GCTraceTime t("CMS:MSC ", PrintGCDetails && Verbose, true, NULL, gc_tracer->gc_id());
2003 if (PrintGC && Verbose && !(GCCause::is_user_requested_gc(gch->gc_cause()))) { 2003 if (PrintGC && Verbose && !(GCCause::is_user_requested_gc(gch->gc_cause()))) {
2004 gclog_or_tty->print_cr("Compact ConcurrentMarkSweepGeneration after %d " 2004 gclog_or_tty->print_cr("Compact ConcurrentMarkSweepGeneration after %d "
2005 "collections passed to foreground collector", _full_gcs_since_conc_gc); 2005 "collections passed to foreground collector", _full_gcs_since_conc_gc);
2006 } 2006 }
2007 2007
2507 assert(Thread::current()->is_VM_thread(), "A foreground collection" 2507 assert(Thread::current()->is_VM_thread(), "A foreground collection"
2508 "may only be done by the VM Thread with the world stopped"); 2508 "may only be done by the VM Thread with the world stopped");
2509 assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(), 2509 assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
2510 "VM thread should have CMS token"); 2510 "VM thread should have CMS token");
2511 2511
2512 // The gc id is created in register_foreground_gc_start if this collection is synchronous
2513 const GCId gc_id = _collectorState == InitialMarking ? GCId::peek() : _gc_tracer_cm->gc_id();
2512 NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose, 2514 NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
2513 true, NULL);) 2515 true, NULL, gc_id);)
2514 if (UseAdaptiveSizePolicy) { 2516 if (UseAdaptiveSizePolicy) {
2515 size_policy()->ms_collection_begin(); 2517 size_policy()->ms_collection_begin();
2516 } 2518 }
2517 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); 2519 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
2518 2520
3525 // phases. 3527 // phases.
3526 class CMSPhaseAccounting: public StackObj { 3528 class CMSPhaseAccounting: public StackObj {
3527 public: 3529 public:
3528 CMSPhaseAccounting(CMSCollector *collector, 3530 CMSPhaseAccounting(CMSCollector *collector,
3529 const char *phase, 3531 const char *phase,
3532 const GCId gc_id,
3530 bool print_cr = true); 3533 bool print_cr = true);
3531 ~CMSPhaseAccounting(); 3534 ~CMSPhaseAccounting();
3532 3535
3533 private: 3536 private:
3534 CMSCollector *_collector; 3537 CMSCollector *_collector;
3535 const char *_phase; 3538 const char *_phase;
3536 elapsedTimer _wallclock; 3539 elapsedTimer _wallclock;
3537 bool _print_cr; 3540 bool _print_cr;
3541 const GCId _gc_id;
3538 3542
3539 public: 3543 public:
3540 // Not MT-safe; so do not pass around these StackObj's 3544 // Not MT-safe; so do not pass around these StackObj's
3541 // where they may be accessed by other threads. 3545 // where they may be accessed by other threads.
3542 jlong wallclock_millis() { 3546 jlong wallclock_millis() {
3548 } 3552 }
3549 }; 3553 };
3550 3554
3551 CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector, 3555 CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector,
3552 const char *phase, 3556 const char *phase,
3557 const GCId gc_id,
3553 bool print_cr) : 3558 bool print_cr) :
3554 _collector(collector), _phase(phase), _print_cr(print_cr) { 3559 _collector(collector), _phase(phase), _print_cr(print_cr), _gc_id(gc_id) {
3555 3560
3556 if (PrintCMSStatistics != 0) { 3561 if (PrintCMSStatistics != 0) {
3557 _collector->resetYields(); 3562 _collector->resetYields();
3558 } 3563 }
3559 if (PrintGCDetails) { 3564 if (PrintGCDetails) {
3560 gclog_or_tty->date_stamp(PrintGCDateStamps); 3565 gclog_or_tty->gclog_stamp(_gc_id);
3561 gclog_or_tty->stamp(PrintGCTimeStamps);
3562 gclog_or_tty->print_cr("[%s-concurrent-%s-start]", 3566 gclog_or_tty->print_cr("[%s-concurrent-%s-start]",
3563 _collector->cmsGen()->short_name(), _phase); 3567 _collector->cmsGen()->short_name(), _phase);
3564 } 3568 }
3565 _collector->resetTimer(); 3569 _collector->resetTimer();
3566 _wallclock.start(); 3570 _wallclock.start();
3570 CMSPhaseAccounting::~CMSPhaseAccounting() { 3574 CMSPhaseAccounting::~CMSPhaseAccounting() {
3571 assert(_wallclock.is_active(), "Wall clock should not have stopped"); 3575 assert(_wallclock.is_active(), "Wall clock should not have stopped");
3572 _collector->stopTimer(); 3576 _collector->stopTimer();
3573 _wallclock.stop(); 3577 _wallclock.stop();
3574 if (PrintGCDetails) { 3578 if (PrintGCDetails) {
3575 gclog_or_tty->date_stamp(PrintGCDateStamps); 3579 gclog_or_tty->gclog_stamp(_gc_id);
3576 gclog_or_tty->stamp(PrintGCTimeStamps);
3577 gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]", 3580 gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]",
3578 _collector->cmsGen()->short_name(), 3581 _collector->cmsGen()->short_name(),
3579 _phase, _collector->timerValue(), _wallclock.seconds()); 3582 _phase, _collector->timerValue(), _wallclock.seconds());
3580 if (_print_cr) { 3583 if (_print_cr) {
3581 gclog_or_tty->cr(); 3584 gclog_or_tty->cr();
3669 // Setup the verification and class unloading state for this 3672 // Setup the verification and class unloading state for this
3670 // CMS collection cycle. 3673 // CMS collection cycle.
3671 setup_cms_unloading_and_verification_state(); 3674 setup_cms_unloading_and_verification_state();
3672 3675
3673 NOT_PRODUCT(GCTraceTime t("\ncheckpointRootsInitialWork", 3676 NOT_PRODUCT(GCTraceTime t("\ncheckpointRootsInitialWork",
3674 PrintGCDetails && Verbose, true, _gc_timer_cm);) 3677 PrintGCDetails && Verbose, true, _gc_timer_cm, _gc_tracer_cm->gc_id());)
3675 if (UseAdaptiveSizePolicy) { 3678 if (UseAdaptiveSizePolicy) {
3676 size_policy()->checkpoint_roots_initial_begin(); 3679 size_policy()->checkpoint_roots_initial_begin();
3677 } 3680 }
3678 3681
3679 // Reset all the PLAB chunk arrays if necessary. 3682 // Reset all the PLAB chunk arrays if necessary.
3794 // refs in this generation concurrent (but interleaved) with 3797 // refs in this generation concurrent (but interleaved) with
3795 // weak ref discovery by a younger generation collector. 3798 // weak ref discovery by a younger generation collector.
3796 3799
3797 CMSTokenSyncWithLocks ts(true, bitMapLock()); 3800 CMSTokenSyncWithLocks ts(true, bitMapLock());
3798 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 3801 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
3799 CMSPhaseAccounting pa(this, "mark", !PrintGCDetails); 3802 CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails);
3800 res = markFromRootsWork(asynch); 3803 res = markFromRootsWork(asynch);
3801 if (res) { 3804 if (res) {
3802 _collectorState = Precleaning; 3805 _collectorState = Precleaning;
3803 } else { // We failed and a foreground collection wants to take over 3806 } else { // We failed and a foreground collection wants to take over
3804 assert(_foregroundGCIsActive, "internal state inconsistency"); 3807 assert(_foregroundGCIsActive, "internal state inconsistency");
4517 _start_sampling = true; 4520 _start_sampling = true;
4518 } else { 4521 } else {
4519 _start_sampling = false; 4522 _start_sampling = false;
4520 } 4523 }
4521 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 4524 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
4522 CMSPhaseAccounting pa(this, "preclean", !PrintGCDetails); 4525 CMSPhaseAccounting pa(this, "preclean", _gc_tracer_cm->gc_id(), !PrintGCDetails);
4523 preclean_work(CMSPrecleanRefLists1, CMSPrecleanSurvivors1); 4526 preclean_work(CMSPrecleanRefLists1, CMSPrecleanSurvivors1);
4524 } 4527 }
4525 CMSTokenSync x(true); // is cms thread 4528 CMSTokenSync x(true); // is cms thread
4526 if (CMSPrecleaningEnabled) { 4529 if (CMSPrecleaningEnabled) {
4527 sample_eden(); 4530 sample_eden();
4546 // schedule the pause as described avove. By choosing 4549 // schedule the pause as described avove. By choosing
4547 // CMSScheduleRemarkEdenSizeThreshold >= max eden size 4550 // CMSScheduleRemarkEdenSizeThreshold >= max eden size
4548 // we will never do an actual abortable preclean cycle. 4551 // we will never do an actual abortable preclean cycle.
4549 if (get_eden_used() > CMSScheduleRemarkEdenSizeThreshold) { 4552 if (get_eden_used() > CMSScheduleRemarkEdenSizeThreshold) {
4550 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 4553 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
4551 CMSPhaseAccounting pa(this, "abortable-preclean", !PrintGCDetails); 4554 CMSPhaseAccounting pa(this, "abortable-preclean", _gc_tracer_cm->gc_id(), !PrintGCDetails);
4552 // We need more smarts in the abortable preclean 4555 // We need more smarts in the abortable preclean
4553 // loop below to deal with cases where allocation 4556 // loop below to deal with cases where allocation
4554 // in young gen is very very slow, and our precleaning 4557 // in young gen is very very slow, and our precleaning
4555 // is running a losing race against a horde of 4558 // is running a losing race against a horde of
4556 // mutators intent on flooding us with CMS updates 4559 // mutators intent on flooding us with CMS updates
4691 // tweaking for better performance and some restructuring 4694 // tweaking for better performance and some restructuring
4692 // for cleaner interfaces. 4695 // for cleaner interfaces.
4693 GCTimer *gc_timer = NULL; // Currently not tracing concurrent phases 4696 GCTimer *gc_timer = NULL; // Currently not tracing concurrent phases
4694 rp->preclean_discovered_references( 4697 rp->preclean_discovered_references(
4695 rp->is_alive_non_header(), &keep_alive, &complete_trace, &yield_cl, 4698 rp->is_alive_non_header(), &keep_alive, &complete_trace, &yield_cl,
4696 gc_timer); 4699 gc_timer, _gc_tracer_cm->gc_id());
4697 } 4700 }
4698 4701
4699 if (clean_survivor) { // preclean the active survivor space(s) 4702 if (clean_survivor) { // preclean the active survivor space(s)
4700 assert(_young_gen->kind() == Generation::DefNew || 4703 assert(_young_gen->kind() == Generation::DefNew ||
4701 _young_gen->kind() == Generation::ParNew || 4704 _young_gen->kind() == Generation::ParNew ||
5034 GenCollectedHeap* gch = GenCollectedHeap::heap(); 5037 GenCollectedHeap* gch = GenCollectedHeap::heap();
5035 // Temporarily set flag to false, GCH->do_collection will 5038 // Temporarily set flag to false, GCH->do_collection will
5036 // expect it to be false and set to true 5039 // expect it to be false and set to true
5037 FlagSetting fl(gch->_is_gc_active, false); 5040 FlagSetting fl(gch->_is_gc_active, false);
5038 NOT_PRODUCT(GCTraceTime t("Scavenge-Before-Remark", 5041 NOT_PRODUCT(GCTraceTime t("Scavenge-Before-Remark",
5039 PrintGCDetails && Verbose, true, _gc_timer_cm);) 5042 PrintGCDetails && Verbose, true, _gc_timer_cm, _gc_tracer_cm->gc_id());)
5040 int level = _cmsGen->level() - 1; 5043 int level = _cmsGen->level() - 1;
5041 if (level >= 0) { 5044 if (level >= 0) {
5042 gch->do_collection(true, // full (i.e. force, see below) 5045 gch->do_collection(true, // full (i.e. force, see below)
5043 false, // !clear_all_soft_refs 5046 false, // !clear_all_soft_refs
5044 0, // size 5047 0, // size
5063 } 5066 }
5064 5067
5065 void CMSCollector::checkpointRootsFinalWork(bool asynch, 5068 void CMSCollector::checkpointRootsFinalWork(bool asynch,
5066 bool clear_all_soft_refs, bool init_mark_was_synchronous) { 5069 bool clear_all_soft_refs, bool init_mark_was_synchronous) {
5067 5070
5068 NOT_PRODUCT(GCTraceTime tr("checkpointRootsFinalWork", PrintGCDetails, false, _gc_timer_cm);) 5071 NOT_PRODUCT(GCTraceTime tr("checkpointRootsFinalWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
5069 5072
5070 assert(haveFreelistLocks(), "must have free list locks"); 5073 assert(haveFreelistLocks(), "must have free list locks");
5071 assert_lock_strong(bitMapLock()); 5074 assert_lock_strong(bitMapLock());
5072 5075
5073 if (UseAdaptiveSizePolicy) { 5076 if (UseAdaptiveSizePolicy) {
5118 // are detected via the mod union table which is the set of all cards 5121 // are detected via the mod union table which is the set of all cards
5119 // dirtied since the first checkpoint in this GC cycle and prior to 5122 // dirtied since the first checkpoint in this GC cycle and prior to
5120 // the most recent young generation GC, minus those cleaned up by the 5123 // the most recent young generation GC, minus those cleaned up by the
5121 // concurrent precleaning. 5124 // concurrent precleaning.
5122 if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) { 5125 if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
5123 GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm); 5126 GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
5124 do_remark_parallel(); 5127 do_remark_parallel();
5125 } else { 5128 } else {
5126 GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false, 5129 GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false,
5127 _gc_timer_cm); 5130 _gc_timer_cm, _gc_tracer_cm->gc_id());
5128 do_remark_non_parallel(); 5131 do_remark_non_parallel();
5129 } 5132 }
5130 } 5133 }
5131 } else { 5134 } else {
5132 assert(!asynch, "Can't have init_mark_was_synchronous in asynch mode"); 5135 assert(!asynch, "Can't have init_mark_was_synchronous in asynch mode");
5135 } 5138 }
5136 verify_work_stacks_empty(); 5139 verify_work_stacks_empty();
5137 verify_overflow_empty(); 5140 verify_overflow_empty();
5138 5141
5139 { 5142 {
5140 NOT_PRODUCT(GCTraceTime ts("refProcessingWork", PrintGCDetails, false, _gc_timer_cm);) 5143 NOT_PRODUCT(GCTraceTime ts("refProcessingWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
5141 refProcessingWork(asynch, clear_all_soft_refs); 5144 refProcessingWork(asynch, clear_all_soft_refs);
5142 } 5145 }
5143 verify_work_stacks_empty(); 5146 verify_work_stacks_empty();
5144 verify_overflow_empty(); 5147 verify_overflow_empty();
5145 5148
5920 MarkFromDirtyCardsClosure 5923 MarkFromDirtyCardsClosure
5921 markFromDirtyCardsClosure(this, _span, 5924 markFromDirtyCardsClosure(this, _span,
5922 NULL, // space is set further below 5925 NULL, // space is set further below
5923 &_markBitMap, &_markStack, &mrias_cl); 5926 &_markBitMap, &_markStack, &mrias_cl);
5924 { 5927 {
5925 GCTraceTime t("grey object rescan", PrintGCDetails, false, _gc_timer_cm); 5928 GCTraceTime t("grey object rescan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
5926 // Iterate over the dirty cards, setting the corresponding bits in the 5929 // Iterate over the dirty cards, setting the corresponding bits in the
5927 // mod union table. 5930 // mod union table.
5928 { 5931 {
5929 ModUnionClosure modUnionClosure(&_modUnionTable); 5932 ModUnionClosure modUnionClosure(&_modUnionTable);
5930 _ct->ct_bs()->dirty_card_iterate( 5933 _ct->ct_bs()->dirty_card_iterate(
5957 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { 5960 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
5958 HandleMark hm; // Discard invalid handles created during verification 5961 HandleMark hm; // Discard invalid handles created during verification
5959 Universe::verify(); 5962 Universe::verify();
5960 } 5963 }
5961 { 5964 {
5962 GCTraceTime t("root rescan", PrintGCDetails, false, _gc_timer_cm); 5965 GCTraceTime t("root rescan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
5963 5966
5964 verify_work_stacks_empty(); 5967 verify_work_stacks_empty();
5965 5968
5966 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. 5969 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
5967 GenCollectedHeap::StrongRootsScope srs(gch); 5970 GenCollectedHeap::StrongRootsScope srs(gch);
5979 || (roots_scanning_options() & SharedHeap::SO_CodeCache), 5982 || (roots_scanning_options() & SharedHeap::SO_CodeCache),
5980 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); 5983 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
5981 } 5984 }
5982 5985
5983 { 5986 {
5984 GCTraceTime t("visit unhandled CLDs", PrintGCDetails, false, _gc_timer_cm); 5987 GCTraceTime t("visit unhandled CLDs", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
5985 5988
5986 verify_work_stacks_empty(); 5989 verify_work_stacks_empty();
5987 5990
5988 // Scan all class loader data objects that might have been introduced 5991 // Scan all class loader data objects that might have been introduced
5989 // during concurrent marking. 5992 // during concurrent marking.
5998 6001
5999 verify_work_stacks_empty(); 6002 verify_work_stacks_empty();
6000 } 6003 }
6001 6004
6002 { 6005 {
6003 GCTraceTime t("dirty klass scan", PrintGCDetails, false, _gc_timer_cm); 6006 GCTraceTime t("dirty klass scan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
6004 6007
6005 verify_work_stacks_empty(); 6008 verify_work_stacks_empty();
6006 6009
6007 RemarkKlassClosure remark_klass_closure(&mrias_cl); 6010 RemarkKlassClosure remark_klass_closure(&mrias_cl);
6008 ClassLoaderDataGraph::classes_do(&remark_klass_closure); 6011 ClassLoaderDataGraph::classes_do(&remark_klass_closure);
6200 &_markStack, false /* !preclean */); 6203 &_markStack, false /* !preclean */);
6201 CMSDrainMarkingStackClosure cmsDrainMarkingStackClosure(this, 6204 CMSDrainMarkingStackClosure cmsDrainMarkingStackClosure(this,
6202 _span, &_markBitMap, &_markStack, 6205 _span, &_markBitMap, &_markStack,
6203 &cmsKeepAliveClosure, false /* !preclean */); 6206 &cmsKeepAliveClosure, false /* !preclean */);
6204 { 6207 {
6205 GCTraceTime t("weak refs processing", PrintGCDetails, false, _gc_timer_cm); 6208 GCTraceTime t("weak refs processing", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
6206 6209
6207 ReferenceProcessorStats stats; 6210 ReferenceProcessorStats stats;
6208 if (rp->processing_is_mt()) { 6211 if (rp->processing_is_mt()) {
6209 // Set the degree of MT here. If the discovery is done MT, there 6212 // Set the degree of MT here. If the discovery is done MT, there
6210 // may have been a different number of threads doing the discovery 6213 // may have been a different number of threads doing the discovery
6225 CMSRefProcTaskExecutor task_executor(*this); 6228 CMSRefProcTaskExecutor task_executor(*this);
6226 stats = rp->process_discovered_references(&_is_alive_closure, 6229 stats = rp->process_discovered_references(&_is_alive_closure,
6227 &cmsKeepAliveClosure, 6230 &cmsKeepAliveClosure,
6228 &cmsDrainMarkingStackClosure, 6231 &cmsDrainMarkingStackClosure,
6229 &task_executor, 6232 &task_executor,
6230 _gc_timer_cm); 6233 _gc_timer_cm,
6234 _gc_tracer_cm->gc_id());
6231 } else { 6235 } else {
6232 stats = rp->process_discovered_references(&_is_alive_closure, 6236 stats = rp->process_discovered_references(&_is_alive_closure,
6233 &cmsKeepAliveClosure, 6237 &cmsKeepAliveClosure,
6234 &cmsDrainMarkingStackClosure, 6238 &cmsDrainMarkingStackClosure,
6235 NULL, 6239 NULL,
6236 _gc_timer_cm); 6240 _gc_timer_cm,
6241 _gc_tracer_cm->gc_id());
6237 } 6242 }
6238 _gc_tracer_cm->report_gc_reference_stats(stats); 6243 _gc_tracer_cm->report_gc_reference_stats(stats);
6239 6244
6240 } 6245 }
6241 6246
6242 // This is the point where the entire marking should have completed. 6247 // This is the point where the entire marking should have completed.
6243 verify_work_stacks_empty(); 6248 verify_work_stacks_empty();
6244 6249
6245 if (should_unload_classes()) { 6250 if (should_unload_classes()) {
6246 { 6251 {
6247 GCTraceTime t("class unloading", PrintGCDetails, false, _gc_timer_cm); 6252 GCTraceTime t("class unloading", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
6248 6253
6249 // Unload classes and purge the SystemDictionary. 6254 // Unload classes and purge the SystemDictionary.
6250 bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure); 6255 bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure);
6251 6256
6252 // Unload nmethods. 6257 // Unload nmethods.
6255 // Prune dead klasses from subklass/sibling/implementor lists. 6260 // Prune dead klasses from subklass/sibling/implementor lists.
6256 Klass::clean_weak_klass_links(&_is_alive_closure); 6261 Klass::clean_weak_klass_links(&_is_alive_closure);
6257 } 6262 }
6258 6263
6259 { 6264 {
6260 GCTraceTime t("scrub symbol table", PrintGCDetails, false, _gc_timer_cm); 6265 GCTraceTime t("scrub symbol table", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
6261 // Clean up unreferenced symbols in symbol table. 6266 // Clean up unreferenced symbols in symbol table.
6262 SymbolTable::unlink(); 6267 SymbolTable::unlink();
6263 } 6268 }
6264 } 6269 }
6265 6270
6266 // CMS doesn't use the StringTable as hard roots when class unloading is turned off. 6271 // CMS doesn't use the StringTable as hard roots when class unloading is turned off.
6267 // Need to check if we really scanned the StringTable. 6272 // Need to check if we really scanned the StringTable.
6268 if ((roots_scanning_options() & SharedHeap::SO_Strings) == 0) { 6273 if ((roots_scanning_options() & SharedHeap::SO_Strings) == 0) {
6269 GCTraceTime t("scrub string table", PrintGCDetails, false, _gc_timer_cm); 6274 GCTraceTime t("scrub string table", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
6270 // Delete entries for dead interned strings. 6275 // Delete entries for dead interned strings.
6271 StringTable::unlink(&_is_alive_closure); 6276 StringTable::unlink(&_is_alive_closure);
6272 } 6277 }
6273 6278
6274 // Restore any preserved marks as a result of mark stack or 6279 // Restore any preserved marks as a result of mark stack or
6331 assert(!_intra_sweep_timer.is_active(), "Should not be active"); 6336 assert(!_intra_sweep_timer.is_active(), "Should not be active");
6332 _intra_sweep_timer.reset(); 6337 _intra_sweep_timer.reset();
6333 _intra_sweep_timer.start(); 6338 _intra_sweep_timer.start();
6334 if (asynch) { 6339 if (asynch) {
6335 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 6340 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
6336 CMSPhaseAccounting pa(this, "sweep", !PrintGCDetails); 6341 CMSPhaseAccounting pa(this, "sweep", _gc_tracer_cm->gc_id(), !PrintGCDetails);
6337 // First sweep the old gen 6342 // First sweep the old gen
6338 { 6343 {
6339 CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock(), 6344 CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock(),
6340 bitMapLock()); 6345 bitMapLock());
6341 sweepWork(_cmsGen, asynch); 6346 sweepWork(_cmsGen, asynch);
6552 } 6557 }
6553 6558
6554 // Clear the mark bitmap (no grey objects to start with) 6559 // Clear the mark bitmap (no grey objects to start with)
6555 // for the next cycle. 6560 // for the next cycle.
6556 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 6561 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
6557 CMSPhaseAccounting cmspa(this, "reset", !PrintGCDetails); 6562 CMSPhaseAccounting cmspa(this, "reset", _gc_tracer_cm->gc_id(), !PrintGCDetails);
6558 6563
6559 HeapWord* curAddr = _markBitMap.startWord(); 6564 HeapWord* curAddr = _markBitMap.startWord();
6560 while (curAddr < _markBitMap.endWord()) { 6565 while (curAddr < _markBitMap.endWord()) {
6561 size_t remaining = pointer_delta(_markBitMap.endWord(), curAddr); 6566 size_t remaining = pointer_delta(_markBitMap.endWord(), curAddr);
6562 MemRegion chunk(curAddr, MIN2(CMSBitMapYieldQuantum, remaining)); 6567 MemRegion chunk(curAddr, MIN2(CMSBitMapYieldQuantum, remaining));
6618 } 6623 }
6619 6624
6620 void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) { 6625 void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
6621 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); 6626 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
6622 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); 6627 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
6623 GCTraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL); 6628 GCTraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer_cm->gc_id());
6624 TraceCollectorStats tcs(counters()); 6629 TraceCollectorStats tcs(counters());
6625 6630
6626 switch (op) { 6631 switch (op) {
6627 case CMS_op_checkpointRootsInitial: { 6632 case CMS_op_checkpointRootsInitial: {
6628 SvcGCMarker sgcm(SvcGCMarker::OTHER); 6633 SvcGCMarker sgcm(SvcGCMarker::OTHER);