comparison src/share/vm/gc_implementation/g1/g1RemSet.cpp @ 22905:8e9ede9dd2cd

8067655: Clean up G1 remembered set oop iteration Summary: Pass on the static type G1ParPushHeapRSClosure to allow oop_iterate devirtualization Reviewed-by: jmasa, kbarrett
author mgerdin
date Mon, 08 Dec 2014 18:57:33 +0100
parents 80ac3ee51955
children ad32e85474ff
comparison
equal deleted inserted replaced
22904:36c7518fd486 22905:8e9ede9dd2cd
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 MemRegion card_region(_bot_shared->address_for_index(index), G1BlockOffsetSharedArray::N_words); 149 MemRegion card_region(_bot_shared->address_for_index(index), G1BlockOffsetSharedArray::N_words);
151 MemRegion pre_gc_allocated(r->bottom(), r->scan_top()); 150 MemRegion pre_gc_allocated(r->bottom(), r->scan_top());
236 235
237 size_t cards_done() { return _cards_done;} 236 size_t cards_done() { return _cards_done;}
238 size_t cards_looked_up() { return _cards;} 237 size_t cards_looked_up() { return _cards;}
239 }; 238 };
240 239
241 void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, 240 void G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
242 CodeBlobClosure* code_root_cl, 241 CodeBlobClosure* code_root_cl,
243 uint worker_i) { 242 uint worker_i) {
244 double rs_time_start = os::elapsedTime(); 243 double rs_time_start = os::elapsedTime();
245 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i); 244 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i);
246 245
315 314
316 void G1RemSet::cleanupHRRS() { 315 void G1RemSet::cleanupHRRS() {
317 HeapRegionRemSet::cleanup(); 316 HeapRegionRemSet::cleanup();
318 } 317 }
319 318
320 void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, 319 void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
321 CodeBlobClosure* code_root_cl, 320 CodeBlobClosure* code_root_cl,
322 uint worker_i) { 321 uint worker_i) {
323 #if CARD_REPEAT_HISTO 322 #if CARD_REPEAT_HISTO
324 ct_freq_update_histo_and_reset(); 323 ct_freq_update_histo_and_reset();
325 #endif 324 #endif
457 _c1(c1), _c2(c2) { } 456 _c1(c1), _c2(c2) { }
458 457
459 G1UpdateRSOrPushRefOopClosure:: 458 G1UpdateRSOrPushRefOopClosure::
460 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, 459 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
461 G1RemSet* rs, 460 G1RemSet* rs,
462 OopsInHeapRegionClosure* push_ref_cl, 461 G1ParPushHeapRSClosure* push_ref_cl,
463 bool record_refs_into_cset, 462 bool record_refs_into_cset,
464 uint worker_i) : 463 uint worker_i) :
465 _g1(g1h), _g1_rem_set(rs), _from(NULL), 464 _g1(g1h), _g1_rem_set(rs), _from(NULL),
466 _record_refs_into_cset(record_refs_into_cset), 465 _record_refs_into_cset(record_refs_into_cset),
467 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { } 466 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { }
558 #if CARD_REPEAT_HISTO 557 #if CARD_REPEAT_HISTO
559 init_ct_freq_table(_g1->max_capacity()); 558 init_ct_freq_table(_g1->max_capacity());
560 ct_freq_note_card(_ct_bs->index_for(start)); 559 ct_freq_note_card(_ct_bs->index_for(start));
561 #endif 560 #endif
562 561
563 OopsInHeapRegionClosure* oops_in_heap_closure = NULL; 562 G1ParPushHeapRSClosure* oops_in_heap_closure = NULL;
564 if (check_for_refs_into_cset) { 563 if (check_for_refs_into_cset) {
565 // ConcurrentG1RefineThreads have worker numbers larger than what 564 // ConcurrentG1RefineThreads have worker numbers larger than what
566 // _cset_rs_update_cl[] is set up to handle. But those threads should 565 // _cset_rs_update_cl[] is set up to handle. But those threads should
567 // only be active outside of a collection which means that when they 566 // only be active outside of a collection which means that when they
568 // reach here they should have check_for_refs_into_cset == false. 567 // reach here they should have check_for_refs_into_cset == false.