src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp

changeset 578
b5489bb705c9
parent 548
ba764ed4b6f2
child 622
790e66e5fbac
child 777
37f87013dfd8
equal deleted inserted replaced
577:8bd1e4487c18 578:b5489bb705c9
518 _perm_gen_verify_bit_map(0, -1 /* no mutex */, "No_lock"), 518 _perm_gen_verify_bit_map(0, -1 /* no mutex */, "No_lock"),
519 _modUnionTable((CardTableModRefBS::card_shift - LogHeapWordSize), 519 _modUnionTable((CardTableModRefBS::card_shift - LogHeapWordSize),
520 -1 /* lock-free */, "No_lock" /* dummy */), 520 -1 /* lock-free */, "No_lock" /* dummy */),
521 _modUnionClosure(&_modUnionTable), 521 _modUnionClosure(&_modUnionTable),
522 _modUnionClosurePar(&_modUnionTable), 522 _modUnionClosurePar(&_modUnionTable),
523 _is_alive_closure(&_markBitMap), 523 // Adjust my span to cover old (cms) gen and perm gen
524 _span(cmsGen->reserved()._union(permGen->reserved())),
525 // Construct the is_alive_closure with _span & markBitMap
526 _is_alive_closure(_span, &_markBitMap),
524 _restart_addr(NULL), 527 _restart_addr(NULL),
525 _overflow_list(NULL), 528 _overflow_list(NULL),
526 _preserved_oop_stack(NULL), 529 _preserved_oop_stack(NULL),
527 _preserved_mark_stack(NULL), 530 _preserved_mark_stack(NULL),
528 _stats(cmsGen), 531 _stats(cmsGen),
569 "_cmsGen->end() different from _permGen->start()"); 572 "_cmsGen->end() different from _permGen->start()");
570 573
571 // For use by dirty card to oop closures. 574 // For use by dirty card to oop closures.
572 _cmsGen->cmsSpace()->set_collector(this); 575 _cmsGen->cmsSpace()->set_collector(this);
573 _permGen->cmsSpace()->set_collector(this); 576 _permGen->cmsSpace()->set_collector(this);
574
575 // Adjust my span to cover old (cms) gen and perm gen
576 _span = _cmsGen->reserved()._union(_permGen->reserved());
577 // Initialize the span of is_alive_closure
578 _is_alive_closure.set_span(_span);
579 577
580 // Allocate MUT and marking bit map 578 // Allocate MUT and marking bit map
581 { 579 {
582 MutexLockerEx x(_markBitMap.lock(), Mutex::_no_safepoint_check_flag); 580 MutexLockerEx x(_markBitMap.lock(), Mutex::_no_safepoint_check_flag);
583 if (!_markBitMap.allocate(_span)) { 581 if (!_markBitMap.allocate(_span)) {
5494 //////////////////////////////////////////////////////// 5492 ////////////////////////////////////////////////////////
5495 class CMSRefProcTaskProxy: public AbstractGangTask { 5493 class CMSRefProcTaskProxy: public AbstractGangTask {
5496 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask; 5494 typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
5497 CMSCollector* _collector; 5495 CMSCollector* _collector;
5498 CMSBitMap* _mark_bit_map; 5496 CMSBitMap* _mark_bit_map;
5499 MemRegion _span; 5497 const MemRegion _span;
5500 OopTaskQueueSet* _task_queues; 5498 OopTaskQueueSet* _task_queues;
5501 ParallelTaskTerminator _term; 5499 ParallelTaskTerminator _term;
5502 ProcessTask& _task; 5500 ProcessTask& _task;
5503 5501
5504 public: 5502 public:
5511 AbstractGangTask("Process referents by policy in parallel"), 5509 AbstractGangTask("Process referents by policy in parallel"),
5512 _task(task), 5510 _task(task),
5513 _collector(collector), _span(span), _mark_bit_map(mark_bit_map), 5511 _collector(collector), _span(span), _mark_bit_map(mark_bit_map),
5514 _task_queues(task_queues), 5512 _task_queues(task_queues),
5515 _term(total_workers, task_queues) 5513 _term(total_workers, task_queues)
5516 { } 5514 {
5515 assert(_collector->_span.equals(_span) && !_span.is_empty(),
5516 "Inconsistency in _span");
5517 }
5517 5518
5518 OopTaskQueueSet* task_queues() { return _task_queues; } 5519 OopTaskQueueSet* task_queues() { return _task_queues; }
5519 5520
5520 OopTaskQueue* work_queue(int i) { return task_queues()->queue(i); } 5521 OopTaskQueue* work_queue(int i) { return task_queues()->queue(i); }
5521 5522
5528 5529
5529 virtual void work(int i); 5530 virtual void work(int i);
5530 }; 5531 };
5531 5532
5532 void CMSRefProcTaskProxy::work(int i) { 5533 void CMSRefProcTaskProxy::work(int i) {
5534 assert(_collector->_span.equals(_span), "Inconsistency in _span");
5533 CMSParKeepAliveClosure par_keep_alive(_collector, _span, 5535 CMSParKeepAliveClosure par_keep_alive(_collector, _span,
5534 _mark_bit_map, work_queue(i)); 5536 _mark_bit_map, work_queue(i));
5535 CMSParDrainMarkingStackClosure par_drain_stack(_collector, _span, 5537 CMSParDrainMarkingStackClosure par_drain_stack(_collector, _span,
5536 _mark_bit_map, work_queue(i)); 5538 _mark_bit_map, work_queue(i));
5537 CMSIsAliveClosure is_alive_closure(_mark_bit_map); 5539 CMSIsAliveClosure is_alive_closure(_span, _mark_bit_map);
5538 _task.work(i, is_alive_closure, par_keep_alive, par_drain_stack); 5540 _task.work(i, is_alive_closure, par_keep_alive, par_drain_stack);
5539 if (_task.marks_oops_alive()) { 5541 if (_task.marks_oops_alive()) {
5540 do_work_steal(i, &par_drain_stack, &par_keep_alive, 5542 do_work_steal(i, &par_drain_stack, &par_keep_alive,
5541 _collector->hash_seed(i)); 5543 _collector->hash_seed(i));
5542 } 5544 }

mercurial