189 }
190 }
191
192 // Mark the range of bits covered by live objects on the mark bitmap between
193 // bottom and NTAMS of the given region.
194 // Returns the number of live bytes marked within that area for the given
195 // heap region.
196 size_t mark_marked_during_marking(G1CMBitMap* mark_bitmap, HeapRegion* hr) {
197 reset_mark_cache();
198
199 size_t marked_bytes = 0;
200
201 HeapWord* ntams = hr->next_top_at_mark_start();
202 HeapWord* start = hr->bottom();
203
204 if (ntams <= start) {
205 // Skip empty regions.
206 return 0;
207 }
208 if (hr->is_humongous()) {
209 mark_card_bitmap_range(start, hr->top());
210 return pointer_delta(hr->top(), start, 1);
211 }
212
213 assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
214 "Preconditions not met - "
215 "start: " PTR_FORMAT ", ntams: " PTR_FORMAT ", end: " PTR_FORMAT,
216 p2i(start), p2i(ntams), p2i(hr->end()));
217
218 // Find the first marked object at or after "start".
219 start = mark_bitmap->getNextMarkedWordAddress(start, ntams);
220 while (start < ntams) {
221 oop obj = oop(start);
222 size_t obj_size = obj->size();
223 HeapWord* obj_end = start + obj_size;
224
225 assert(obj_end <= hr->end(), "Humongous objects must have been handled elsewhere.");
226
227 mark_card_bitmap_range(start, obj_end);
228
229 // Add the size of this object to the number of marked bytes.
230 marked_bytes += obj_size * HeapWordSize;
|
189 }
190 }
191
192 // Mark the range of bits covered by live objects on the mark bitmap between
193 // bottom and NTAMS of the given region.
194 // Returns the number of live bytes marked within that area for the given
195 // heap region.
196 size_t mark_marked_during_marking(G1CMBitMap* mark_bitmap, HeapRegion* hr) {
197 reset_mark_cache();
198
199 size_t marked_bytes = 0;
200
201 HeapWord* ntams = hr->next_top_at_mark_start();
202 HeapWord* start = hr->bottom();
203
204 if (ntams <= start) {
205 // Skip empty regions.
206 return 0;
207 }
208 if (hr->is_humongous()) {
209 HeapRegion* start_region = hr->humongous_start_region();
210 if (mark_bitmap->isMarked(start_region->bottom())) {
211 mark_card_bitmap_range(start, hr->top());
212 return pointer_delta(hr->top(), start, 1);
213 } else {
214 // Humongous start object was actually dead.
215 return 0;
216 }
217 }
218
219 assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
220 "Preconditions not met - "
221 "start: " PTR_FORMAT ", ntams: " PTR_FORMAT ", end: " PTR_FORMAT,
222 p2i(start), p2i(ntams), p2i(hr->end()));
223
224 // Find the first marked object at or after "start".
225 start = mark_bitmap->getNextMarkedWordAddress(start, ntams);
226 while (start < ntams) {
227 oop obj = oop(start);
228 size_t obj_size = obj->size();
229 HeapWord* obj_end = start + obj_size;
230
231 assert(obj_end <= hr->end(), "Humongous objects must have been handled elsewhere.");
232
233 mark_card_bitmap_range(start, obj_end);
234
235 // Add the size of this object to the number of marked bytes.
236 marked_bytes += obj_size * HeapWordSize;
|