447 bool CMSCollector::_foregroundGCShouldWait = false; |
447 bool CMSCollector::_foregroundGCShouldWait = false; |
448 |
448 |
449 CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, |
449 CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, |
450 CardTableRS* ct, |
450 CardTableRS* ct, |
451 ConcurrentMarkSweepPolicy* cp): |
451 ConcurrentMarkSweepPolicy* cp): |
|
452 _overflow_list(NULL), |
|
453 _conc_workers(NULL), // may be set later |
|
454 _completed_initialization(false), |
|
455 _collection_count_start(0), |
|
456 _should_unload_classes(CMSClassUnloadingEnabled), |
|
457 _concurrent_cycles_since_last_unload(0), |
|
458 _roots_scanning_options(GenCollectedHeap::SO_None), |
|
459 _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"), |
|
460 _verifying(false), |
|
461 _collector_policy(cp), |
|
462 _inter_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), |
|
463 _intra_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), |
|
464 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) CMSTracer()), |
|
465 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()), |
|
466 _cms_start_registered(false), |
452 _cmsGen(cmsGen), |
467 _cmsGen(cmsGen), |
453 // Adjust span to cover old (cms) gen |
468 // Adjust span to cover old (cms) gen |
454 _span(cmsGen->reserved()), |
469 _span(cmsGen->reserved()), |
455 _ct(ct), |
470 _ct(ct), |
456 _span_based_discoverer(_span), |
|
457 _ref_processor(NULL), // will be set later |
|
458 _conc_workers(NULL), // may be set later |
|
459 _abort_preclean(false), |
|
460 _start_sampling(false), |
|
461 _between_prologue_and_epilogue(false), |
|
462 _markBitMap(0, Mutex::leaf + 1, "CMS_markBitMap_lock"), |
471 _markBitMap(0, Mutex::leaf + 1, "CMS_markBitMap_lock"), |
463 _modUnionTable((CardTable::card_shift - LogHeapWordSize), |
472 _modUnionTable((CardTable::card_shift - LogHeapWordSize), |
464 -1 /* lock-free */, "No_lock" /* dummy */), |
473 -1 /* lock-free */, "No_lock" /* dummy */), |
465 _modUnionClosurePar(&_modUnionTable), |
474 _restart_addr(NULL), |
|
475 _ser_pmc_preclean_ovflw(0), |
|
476 _ser_pmc_remark_ovflw(0), |
|
477 _par_pmc_remark_ovflw(0), |
|
478 _ser_kac_preclean_ovflw(0), |
|
479 _ser_kac_ovflw(0), |
|
480 _par_kac_ovflw(0), |
|
481 #ifndef PRODUCT |
|
482 _num_par_pushes(0), |
|
483 #endif |
|
484 _span_based_discoverer(_span), |
|
485 _ref_processor(NULL), // will be set later |
466 // Construct the is_alive_closure with _span & markBitMap |
486 // Construct the is_alive_closure with _span & markBitMap |
467 _is_alive_closure(_span, &_markBitMap), |
487 _is_alive_closure(_span, &_markBitMap), |
468 _restart_addr(NULL), |
488 _modUnionClosurePar(&_modUnionTable), |
469 _overflow_list(NULL), |
489 _between_prologue_and_epilogue(false), |
|
490 _abort_preclean(false), |
|
491 _start_sampling(false), |
470 _stats(cmsGen), |
492 _stats(cmsGen), |
471 _eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true, |
493 _eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true, |
472 //verify that this lock should be acquired with safepoint check. |
494 //verify that this lock should be acquired with safepoint check. |
473 Monitor::_safepoint_check_sometimes)), |
495 Monitor::_safepoint_check_sometimes)), |
474 _eden_chunk_array(NULL), // may be set in ctor body |
496 _eden_chunk_array(NULL), // may be set in ctor body |
|
497 _eden_chunk_index(0), // -- ditto -- |
475 _eden_chunk_capacity(0), // -- ditto -- |
498 _eden_chunk_capacity(0), // -- ditto -- |
476 _eden_chunk_index(0), // -- ditto -- |
|
477 _survivor_plab_array(NULL), // -- ditto -- |
|
478 _survivor_chunk_array(NULL), // -- ditto -- |
499 _survivor_chunk_array(NULL), // -- ditto -- |
|
500 _survivor_chunk_index(0), // -- ditto -- |
479 _survivor_chunk_capacity(0), // -- ditto -- |
501 _survivor_chunk_capacity(0), // -- ditto -- |
480 _survivor_chunk_index(0), // -- ditto -- |
502 _survivor_plab_array(NULL) // -- ditto -- |
481 _ser_pmc_preclean_ovflw(0), |
|
482 _ser_kac_preclean_ovflw(0), |
|
483 _ser_pmc_remark_ovflw(0), |
|
484 _par_pmc_remark_ovflw(0), |
|
485 _ser_kac_ovflw(0), |
|
486 _par_kac_ovflw(0), |
|
487 #ifndef PRODUCT |
|
488 _num_par_pushes(0), |
|
489 #endif |
|
490 _collection_count_start(0), |
|
491 _verifying(false), |
|
492 _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"), |
|
493 _completed_initialization(false), |
|
494 _collector_policy(cp), |
|
495 _should_unload_classes(CMSClassUnloadingEnabled), |
|
496 _concurrent_cycles_since_last_unload(0), |
|
497 _roots_scanning_options(GenCollectedHeap::SO_None), |
|
498 _inter_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), |
|
499 _intra_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), |
|
500 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) CMSTracer()), |
|
501 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()), |
|
502 _cms_start_registered(false) |
|
503 { |
503 { |
504 // Now expand the span and allocate the collection support structures |
504 // Now expand the span and allocate the collection support structures |
505 // (MUT, marking bit map etc.) to cover both generations subject to |
505 // (MUT, marking bit map etc.) to cover both generations subject to |
506 // collection. |
506 // collection. |
507 |
507 |
3035 CompactibleFreeListSpace* cms_space, |
3035 CompactibleFreeListSpace* cms_space, |
3036 YieldingFlexibleWorkGang* workers, |
3036 YieldingFlexibleWorkGang* workers, |
3037 OopTaskQueueSet* task_queues): |
3037 OopTaskQueueSet* task_queues): |
3038 YieldingFlexibleGangTask("Concurrent marking done multi-threaded"), |
3038 YieldingFlexibleGangTask("Concurrent marking done multi-threaded"), |
3039 _collector(collector), |
3039 _collector(collector), |
|
3040 _n_workers(0), |
|
3041 _result(true), |
3040 _cms_space(cms_space), |
3042 _cms_space(cms_space), |
3041 _n_workers(0), _result(true), |
3043 _bit_map_lock(collector->bitMapLock()), |
3042 _task_queues(task_queues), |
3044 _task_queues(task_queues), |
3043 _term(_n_workers, task_queues, _collector), |
3045 _term(_n_workers, task_queues, _collector) |
3044 _bit_map_lock(collector->bitMapLock()) |
|
3045 { |
3046 { |
3046 _requested_size = _n_workers; |
3047 _requested_size = _n_workers; |
3047 _term.set_task(this); |
3048 _term.set_task(this); |
3048 _term_term.set_task(this); |
3049 _term_term.set_task(this); |
3049 _restart_addr = _global_finger = _cms_space->bottom(); |
3050 _restart_addr = _global_finger = _cms_space->bottom(); |
5850 CMSBitMap* mod_union_table, |
5853 CMSBitMap* mod_union_table, |
5851 CMSMarkStack* mark_stack, |
5854 CMSMarkStack* mark_stack, |
5852 CMSCollector* collector, |
5855 CMSCollector* collector, |
5853 bool should_yield, |
5856 bool should_yield, |
5854 bool concurrent_precleaning): |
5857 bool concurrent_precleaning): |
5855 _collector(collector), |
|
5856 _span(span), |
5858 _span(span), |
5857 _bit_map(bit_map), |
5859 _bit_map(bit_map), |
5858 _mark_stack(mark_stack), |
5860 _mark_stack(mark_stack), |
5859 _pushAndMarkClosure(collector, span, rd, bit_map, mod_union_table, |
5861 _pushAndMarkClosure(collector, span, rd, bit_map, mod_union_table, |
5860 mark_stack, concurrent_precleaning), |
5862 mark_stack, concurrent_precleaning), |
|
5863 _collector(collector), |
|
5864 _freelistLock(NULL), |
5861 _yield(should_yield), |
5865 _yield(should_yield), |
5862 _concurrent_precleaning(concurrent_precleaning), |
5866 _concurrent_precleaning(concurrent_precleaning) |
5863 _freelistLock(NULL) |
|
5864 { |
5867 { |
5865 // FIXME: Should initialize in base class constructor. |
5868 // FIXME: Should initialize in base class constructor. |
5866 assert(rd != NULL, "ref_discoverer shouldn't be NULL"); |
5869 assert(rd != NULL, "ref_discoverer shouldn't be NULL"); |
5867 set_ref_discoverer_internal(rd); |
5870 set_ref_discoverer_internal(rd); |
5868 } |
5871 } |