73 _cset_rs_update_cl(NULL), |
73 _cset_rs_update_cl(NULL), |
74 _cards_scanned(NULL), _total_cards_scanned(0) |
74 _cards_scanned(NULL), _total_cards_scanned(0) |
75 { |
75 { |
76 _seq_task = new SubTasksDone(NumSeqTasks); |
76 _seq_task = new SubTasksDone(NumSeqTasks); |
77 guarantee(n_workers() > 0, "There should be some workers"); |
77 guarantee(n_workers() > 0, "There should be some workers"); |
78 _cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers()); |
78 _cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers(), mtGC); |
79 for (uint i = 0; i < n_workers(); i++) { |
79 for (uint i = 0; i < n_workers(); i++) { |
80 _cset_rs_update_cl[i] = NULL; |
80 _cset_rs_update_cl[i] = NULL; |
81 } |
81 } |
82 } |
82 } |
83 |
83 |
84 G1RemSet::~G1RemSet() { |
84 G1RemSet::~G1RemSet() { |
85 delete _seq_task; |
85 delete _seq_task; |
86 for (uint i = 0; i < n_workers(); i++) { |
86 for (uint i = 0; i < n_workers(); i++) { |
87 assert(_cset_rs_update_cl[i] == NULL, "it should be"); |
87 assert(_cset_rs_update_cl[i] == NULL, "it should be"); |
88 } |
88 } |
89 FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl); |
89 FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC); |
90 } |
90 } |
91 |
91 |
92 void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) { |
92 void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) { |
93 if (_g1->is_in_g1_reserved(mr.start())) { |
93 if (_g1->is_in_g1_reserved(mr.start())) { |
94 _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size)); |
94 _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size)); |
414 // Don't set the number of workers here. It will be set |
414 // Don't set the number of workers here. It will be set |
415 // when the task is run |
415 // when the task is run |
416 // _seq_task->set_n_termination((int)n_workers()); |
416 // _seq_task->set_n_termination((int)n_workers()); |
417 } |
417 } |
418 guarantee( _cards_scanned == NULL, "invariant" ); |
418 guarantee( _cards_scanned == NULL, "invariant" ); |
419 _cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers()); |
419 _cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers(), mtGC); |
420 for (uint i = 0; i < n_workers(); ++i) { |
420 for (uint i = 0; i < n_workers(); ++i) { |
421 _cards_scanned[i] = 0; |
421 _cards_scanned[i] = 0; |
422 } |
422 } |
423 _total_cards_scanned = 0; |
423 _total_cards_scanned = 0; |
424 } |
424 } |
485 guarantee( _cards_scanned != NULL, "invariant" ); |
485 guarantee( _cards_scanned != NULL, "invariant" ); |
486 _total_cards_scanned = 0; |
486 _total_cards_scanned = 0; |
487 for (uint i = 0; i < n_workers(); ++i) { |
487 for (uint i = 0; i < n_workers(); ++i) { |
488 _total_cards_scanned += _cards_scanned[i]; |
488 _total_cards_scanned += _cards_scanned[i]; |
489 } |
489 } |
490 FREE_C_HEAP_ARRAY(size_t, _cards_scanned); |
490 FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC); |
491 _cards_scanned = NULL; |
491 _cards_scanned = NULL; |
492 // Cleanup after copy |
492 // Cleanup after copy |
493 _g1->set_refine_cte_cl_concurrency(true); |
493 _g1->set_refine_cte_cl_concurrency(true); |
494 // Set all cards back to clean. |
494 // Set all cards back to clean. |
495 _g1->cleanUpCardTable(); |
495 _g1->cleanUpCardTable(); |