2406 if (_foregroundGCIsActive) {
2407 CGC_lock->notify();
2408 }
2409 assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
2410 "Possible deadlock");
2411 }
2412 if (TraceCMSState) {
2413 gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
2414 " exiting collection CMS state %d",
2415 Thread::current(), _collectorState);
2416 }
2417 if (PrintGC && Verbose) {
2418 _cmsGen->print_heap_change(prev_used);
2419 }
2420 }
2421
2422 void CMSCollector::register_gc_start(GCCause::Cause cause) {
2423 _cms_start_registered = true;
2424 _gc_timer_cm->register_gc_start(os::elapsed_counter());
2425 _gc_tracer_cm->report_gc_start(cause, _gc_timer_cm->gc_start());
2426 }
2427
2428 void CMSCollector::register_gc_end() {
2429 if (_cms_start_registered) {
2430 _gc_timer_cm->register_gc_end(os::elapsed_counter());
2431 _gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
2432 _cms_start_registered = false;
2433 }
2434 }
2435
2436 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
2437 assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
2438 "Foreground collector should be waiting, not executing");
2439 assert(Thread::current()->is_VM_thread(), "A foreground collection"
2440 "may only be done by the VM Thread with the world stopped");
2441 assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
2442 "VM thread should have CMS token");
2443
2444 NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
2445 true, NULL);)
2446 if (UseAdaptiveSizePolicy) {
2447 size_policy()->ms_collection_begin();
2448 }
2449 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
|
2406 if (_foregroundGCIsActive) {
2407 CGC_lock->notify();
2408 }
2409 assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
2410 "Possible deadlock");
2411 }
2412 if (TraceCMSState) {
2413 gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
2414 " exiting collection CMS state %d",
2415 Thread::current(), _collectorState);
2416 }
2417 if (PrintGC && Verbose) {
2418 _cmsGen->print_heap_change(prev_used);
2419 }
2420 }
2421
2422 void CMSCollector::register_gc_start(GCCause::Cause cause) {
2423 _cms_start_registered = true;
2424 _gc_timer_cm->register_gc_start(os::elapsed_counter());
2425 _gc_tracer_cm->report_gc_start(cause, _gc_timer_cm->gc_start());
2426
2427 GenCollectedHeap* gch = GenCollectedHeap::heap();
2428 gch->trace_heap_before_gc(_gc_tracer_cm);
2429 }
2430
2431 void CMSCollector::register_gc_end() {
2432 if (_cms_start_registered) {
2433 GenCollectedHeap* gch = GenCollectedHeap::heap();
2434 gch->trace_heap_after_gc(_gc_tracer_cm);
2435
2436 _gc_timer_cm->register_gc_end(os::elapsed_counter());
2437 _gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
2438 _cms_start_registered = false;
2439 }
2440 }
2441
2442 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) {
2443 assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
2444 "Foreground collector should be waiting, not executing");
2445 assert(Thread::current()->is_VM_thread(), "A foreground collection"
2446 "may only be done by the VM Thread with the world stopped");
2447 assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
2448 "VM thread should have CMS token");
2449
2450 NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
2451 true, NULL);)
2452 if (UseAdaptiveSizePolicy) {
2453 size_policy()->ms_collection_begin();
2454 }
2455 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
|