src/share/vm/gc_implementation/g1/g1RemSet.cpp

changeset 7971
b554c7fa9478
parent 7218
6948da6d7c13
child 7972
a9b72f566e9f
equal deleted inserted replaced
7970:fb2842d6895c 7971:b554c7fa9478
78 _cards_scanned(NULL), _total_cards_scanned(0), 78 _cards_scanned(NULL), _total_cards_scanned(0),
79 _prev_period_summary() 79 _prev_period_summary()
80 { 80 {
81 _seq_task = new SubTasksDone(NumSeqTasks); 81 _seq_task = new SubTasksDone(NumSeqTasks);
82 guarantee(n_workers() > 0, "There should be some workers"); 82 guarantee(n_workers() > 0, "There should be some workers");
83 _cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers(), mtGC); 83 _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
84 for (uint i = 0; i < n_workers(); i++) { 84 for (uint i = 0; i < n_workers(); i++) {
85 _cset_rs_update_cl[i] = NULL; 85 _cset_rs_update_cl[i] = NULL;
86 } 86 }
87 if (G1SummarizeRSetStats) { 87 if (G1SummarizeRSetStats) {
88 _prev_period_summary.initialize(this); 88 _prev_period_summary.initialize(this);
92 G1RemSet::~G1RemSet() { 92 G1RemSet::~G1RemSet() {
93 delete _seq_task; 93 delete _seq_task;
94 for (uint i = 0; i < n_workers(); i++) { 94 for (uint i = 0; i < n_workers(); i++) {
95 assert(_cset_rs_update_cl[i] == NULL, "it should be"); 95 assert(_cset_rs_update_cl[i] == NULL, "it should be");
96 } 96 }
97 FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC); 97 FREE_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, _cset_rs_update_cl, mtGC);
98 } 98 }
99 99
100 void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) { 100 void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) {
101 if (_g1->is_in_g1_reserved(mr.start())) { 101 if (_g1->is_in_g1_reserved(mr.start())) {
102 _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size)); 102 _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size));
106 106
107 class ScanRSClosure : public HeapRegionClosure { 107 class ScanRSClosure : public HeapRegionClosure {
108 size_t _cards_done, _cards; 108 size_t _cards_done, _cards;
109 G1CollectedHeap* _g1h; 109 G1CollectedHeap* _g1h;
110 110
111 OopsInHeapRegionClosure* _oc; 111 G1ParPushHeapRSClosure* _oc;
112 CodeBlobClosure* _code_root_cl; 112 CodeBlobClosure* _code_root_cl;
113 113
114 G1BlockOffsetSharedArray* _bot_shared; 114 G1BlockOffsetSharedArray* _bot_shared;
115 G1SATBCardTableModRefBS *_ct_bs; 115 G1SATBCardTableModRefBS *_ct_bs;
116 116
118 uint _worker_i; 118 uint _worker_i;
119 int _block_size; 119 int _block_size;
120 bool _try_claimed; 120 bool _try_claimed;
121 121
122 public: 122 public:
123 ScanRSClosure(OopsInHeapRegionClosure* oc, 123 ScanRSClosure(G1ParPushHeapRSClosure* oc,
124 CodeBlobClosure* code_root_cl, 124 CodeBlobClosure* code_root_cl,
125 uint worker_i) : 125 uint worker_i) :
126 _oc(oc), 126 _oc(oc),
127 _code_root_cl(code_root_cl), 127 _code_root_cl(code_root_cl),
128 _strong_code_root_scan_time_sec(0.0), 128 _strong_code_root_scan_time_sec(0.0),
140 void set_try_claimed() { _try_claimed = true; } 140 void set_try_claimed() { _try_claimed = true; }
141 141
142 void scanCard(size_t index, HeapRegion *r) { 142 void scanCard(size_t index, HeapRegion *r) {
143 // Stack allocate the DirtyCardToOopClosure instance 143 // Stack allocate the DirtyCardToOopClosure instance
144 HeapRegionDCTOC cl(_g1h, r, _oc, 144 HeapRegionDCTOC cl(_g1h, r, _oc,
145 CardTableModRefBS::Precise, 145 CardTableModRefBS::Precise);
146 HeapRegionDCTOC::IntoCSFilterKind);
147 146
148 // Set the "from" region in the closure. 147 // Set the "from" region in the closure.
149 _oc->set_region(r); 148 _oc->set_region(r);
150 HeapWord* card_start = _bot_shared->address_for_index(index); 149 HeapWord* card_start = _bot_shared->address_for_index(index);
151 HeapWord* card_end = card_start + G1BlockOffsetSharedArray::N_words; 150 HeapWord* card_end = card_start + G1BlockOffsetSharedArray::N_words;
238 237
239 size_t cards_done() { return _cards_done;} 238 size_t cards_done() { return _cards_done;}
240 size_t cards_looked_up() { return _cards;} 239 size_t cards_looked_up() { return _cards;}
241 }; 240 };
242 241
243 void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, 242 void G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
244 CodeBlobClosure* code_root_cl, 243 CodeBlobClosure* code_root_cl,
245 uint worker_i) { 244 uint worker_i) {
246 double rs_time_start = os::elapsedTime(); 245 double rs_time_start = os::elapsedTime();
247 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i); 246 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i);
248 247
317 316
318 void G1RemSet::cleanupHRRS() { 317 void G1RemSet::cleanupHRRS() {
319 HeapRegionRemSet::cleanup(); 318 HeapRegionRemSet::cleanup();
320 } 319 }
321 320
322 void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, 321 void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
323 CodeBlobClosure* code_root_cl, 322 CodeBlobClosure* code_root_cl,
324 uint worker_i) { 323 uint worker_i) {
325 #if CARD_REPEAT_HISTO 324 #if CARD_REPEAT_HISTO
326 ct_freq_update_histo_and_reset(); 325 ct_freq_update_histo_and_reset();
327 #endif 326 #endif
459 _c1(c1), _c2(c2) { } 458 _c1(c1), _c2(c2) { }
460 459
461 G1UpdateRSOrPushRefOopClosure:: 460 G1UpdateRSOrPushRefOopClosure::
462 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, 461 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
463 G1RemSet* rs, 462 G1RemSet* rs,
464 OopsInHeapRegionClosure* push_ref_cl, 463 G1ParPushHeapRSClosure* push_ref_cl,
465 bool record_refs_into_cset, 464 bool record_refs_into_cset,
466 uint worker_i) : 465 uint worker_i) :
467 _g1(g1h), _g1_rem_set(rs), _from(NULL), 466 _g1(g1h), _g1_rem_set(rs), _from(NULL),
468 _record_refs_into_cset(record_refs_into_cset), 467 _record_refs_into_cset(record_refs_into_cset),
469 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { } 468 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { }
560 #if CARD_REPEAT_HISTO 559 #if CARD_REPEAT_HISTO
561 init_ct_freq_table(_g1->max_capacity()); 560 init_ct_freq_table(_g1->max_capacity());
562 ct_freq_note_card(_ct_bs->index_for(start)); 561 ct_freq_note_card(_ct_bs->index_for(start));
563 #endif 562 #endif
564 563
565 OopsInHeapRegionClosure* oops_in_heap_closure = NULL; 564 G1ParPushHeapRSClosure* oops_in_heap_closure = NULL;
566 if (check_for_refs_into_cset) { 565 if (check_for_refs_into_cset) {
567 // ConcurrentG1RefineThreads have worker numbers larger than what 566 // ConcurrentG1RefineThreads have worker numbers larger than what
568 // _cset_rs_update_cl[] is set up to handle. But those threads should 567 // _cset_rs_update_cl[] is set up to handle. But those threads should
569 // only be active outside of a collection which means that when they 568 // only be active outside of a collection which means that when they
570 // reach here they should have check_for_refs_into_cset == false. 569 // reach here they should have check_for_refs_into_cset == false.

mercurial