68 HeapRegion* _hr; |
68 HeapRegion* _hr; |
69 size_t _marked_bytes; |
69 size_t _marked_bytes; |
70 OopsInHeapRegionClosure *_update_rset_cl; |
70 OopsInHeapRegionClosure *_update_rset_cl; |
71 bool _during_initial_mark; |
71 bool _during_initial_mark; |
72 bool _during_conc_mark; |
72 bool _during_conc_mark; |
|
73 uint _worker_id; |
|
74 |
73 public: |
75 public: |
74 RemoveSelfForwardPtrObjClosure(G1CollectedHeap* g1, ConcurrentMark* cm, |
76 RemoveSelfForwardPtrObjClosure(G1CollectedHeap* g1, ConcurrentMark* cm, |
75 HeapRegion* hr, |
77 HeapRegion* hr, |
76 OopsInHeapRegionClosure* update_rset_cl, |
78 OopsInHeapRegionClosure* update_rset_cl, |
77 bool during_initial_mark, |
79 bool during_initial_mark, |
78 bool during_conc_mark) : |
80 bool during_conc_mark, |
|
81 uint worker_id) : |
79 _g1(g1), _cm(cm), _hr(hr), _marked_bytes(0), |
82 _g1(g1), _cm(cm), _hr(hr), _marked_bytes(0), |
80 _update_rset_cl(update_rset_cl), |
83 _update_rset_cl(update_rset_cl), |
81 _during_initial_mark(during_initial_mark), |
84 _during_initial_mark(during_initial_mark), |
82 _during_conc_mark(during_conc_mark) { } |
85 _during_conc_mark(during_conc_mark), |
|
86 _worker_id(worker_id) { } |
83 |
87 |
84 size_t marked_bytes() { return _marked_bytes; } |
88 size_t marked_bytes() { return _marked_bytes; } |
85 |
89 |
86 // <original comment> |
90 // <original comment> |
87 // The original idea here was to coalesce evacuated and dead objects. |
91 // The original idea here was to coalesce evacuated and dead objects. |
121 // still pointed to be roots. During concurrent marking, and |
125 // still pointed to be roots. During concurrent marking, and |
122 // after initial-mark, we don't need to mark any objects |
126 // after initial-mark, we don't need to mark any objects |
123 // explicitly and all objects in the CSet are considered |
127 // explicitly and all objects in the CSet are considered |
124 // (implicitly) live. So, we won't mark them explicitly and |
128 // (implicitly) live. So, we won't mark them explicitly and |
125 // we'll leave them over NTAMS. |
129 // we'll leave them over NTAMS. |
126 _cm->markNext(obj); |
130 _cm->grayRoot(obj, obj_size, _worker_id); |
127 } |
131 } |
128 _marked_bytes += (obj_size * HeapWordSize); |
132 _marked_bytes += (obj_size * HeapWordSize); |
129 obj->set_mark(markOopDesc::prototype()); |
133 obj->set_mark(markOopDesc::prototype()); |
130 |
134 |
131 // While we were processing RSet buffers during the collection, |
135 // While we were processing RSet buffers during the collection, |
153 |
157 |
154 class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure { |
158 class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure { |
155 G1CollectedHeap* _g1h; |
159 G1CollectedHeap* _g1h; |
156 ConcurrentMark* _cm; |
160 ConcurrentMark* _cm; |
157 OopsInHeapRegionClosure *_update_rset_cl; |
161 OopsInHeapRegionClosure *_update_rset_cl; |
|
162 uint _worker_id; |
158 |
163 |
159 public: |
164 public: |
160 RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h, |
165 RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h, |
161 OopsInHeapRegionClosure* update_rset_cl) : |
166 OopsInHeapRegionClosure* update_rset_cl, |
|
167 uint worker_id) : |
162 _g1h(g1h), _update_rset_cl(update_rset_cl), |
168 _g1h(g1h), _update_rset_cl(update_rset_cl), |
163 _cm(_g1h->concurrent_mark()) { } |
169 _worker_id(worker_id), _cm(_g1h->concurrent_mark()) { } |
164 |
170 |
165 bool doHeapRegion(HeapRegion *hr) { |
171 bool doHeapRegion(HeapRegion *hr) { |
166 bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause(); |
172 bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause(); |
167 bool during_conc_mark = _g1h->mark_in_progress(); |
173 bool during_conc_mark = _g1h->mark_in_progress(); |
168 |
174 |
171 |
177 |
172 if (hr->claimHeapRegion(HeapRegion::ParEvacFailureClaimValue)) { |
178 if (hr->claimHeapRegion(HeapRegion::ParEvacFailureClaimValue)) { |
173 if (hr->evacuation_failed()) { |
179 if (hr->evacuation_failed()) { |
174 RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, _update_rset_cl, |
180 RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, _update_rset_cl, |
175 during_initial_mark, |
181 during_initial_mark, |
176 during_conc_mark); |
182 during_conc_mark, |
|
183 _worker_id); |
177 |
184 |
178 MemRegion mr(hr->bottom(), hr->end()); |
185 MemRegion mr(hr->bottom(), hr->end()); |
179 // We'll recreate the prev marking info so we'll first clear |
186 // We'll recreate the prev marking info so we'll first clear |
180 // the prev bitmap range for this region. We never mark any |
187 // the prev bitmap range for this region. We never mark any |
181 // CSet objects explicitly so the next bitmap range should be |
188 // CSet objects explicitly so the next bitmap range should be |
224 OopsInHeapRegionClosure *update_rset_cl = &deferred_update; |
231 OopsInHeapRegionClosure *update_rset_cl = &deferred_update; |
225 if (!G1DeferredRSUpdate) { |
232 if (!G1DeferredRSUpdate) { |
226 update_rset_cl = &immediate_update; |
233 update_rset_cl = &immediate_update; |
227 } |
234 } |
228 |
235 |
229 RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, update_rset_cl); |
236 RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, update_rset_cl, worker_id); |
230 |
237 |
231 HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id); |
238 HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id); |
232 _g1h->collection_set_iterate_from(hr, &rsfp_cl); |
239 _g1h->collection_set_iterate_from(hr, &rsfp_cl); |
233 } |
240 } |
234 }; |
241 }; |