< prev index next >

src/share/vm/gc/g1/g1CardLiveData.cpp

Print this page
rev 13279 : 8182169: ArrayAllocator should take MEMFLAGS as regular parameter
Reviewed-by: tschatzl, kbarrett
rev 13284 : imported patch 8184346-cleanup-g1cmbitmap


 204   }
 205 
 206   // Mark the range of bits covered by live objects on the mark bitmap between
 207   // bottom and NTAMS of the given region.
 208   // Returns the number of live bytes marked within that area for the given
 209   // heap region.
 210   size_t mark_marked_during_marking(G1CMBitMap* mark_bitmap, HeapRegion* hr) {
 211     reset_mark_cache();
 212 
 213     size_t marked_bytes = 0;
 214 
 215     HeapWord* ntams = hr->next_top_at_mark_start();
 216     HeapWord* start = hr->bottom();
 217 
 218     if (ntams <= start) {
 219       // Skip empty regions.
 220       return 0;
 221     }
 222     if (hr->is_humongous()) {
 223       HeapRegion* start_region = hr->humongous_start_region();
 224       if (mark_bitmap->isMarked(start_region->bottom())) {
 225         mark_card_bitmap_range(start, hr->top());
 226         return pointer_delta(hr->top(), start, 1);
 227       } else {
 228         // Humongous start object was actually dead.
 229         return 0;
 230       }
 231     }
 232 
 233     assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
 234            "Preconditions not met - "
 235            "start: " PTR_FORMAT ", ntams: " PTR_FORMAT ", end: " PTR_FORMAT,
 236            p2i(start), p2i(ntams), p2i(hr->end()));
 237 
 238     // Find the first marked object at or after "start".
 239     start = mark_bitmap->getNextMarkedWordAddress(start, ntams);
 240     while (start < ntams) {
 241       oop obj = oop(start);
 242       size_t obj_size = obj->size();
 243       HeapWord* obj_end = start + obj_size;
 244 
 245       assert(obj_end <= hr->end(), "Humongous objects must have been handled elsewhere.");
 246 
 247       mark_card_bitmap_range(start, obj_end);
 248 
 249       // Add the size of this object to the number of marked bytes.
 250       marked_bytes += obj_size * HeapWordSize;
 251 
 252       // Find the next marked object after this one.
 253       start = mark_bitmap->getNextMarkedWordAddress(obj_end, ntams);
 254     }
 255 
 256     return marked_bytes;
 257   }
 258 
 259   G1CardLiveDataHelper(G1CardLiveData* live_data, HeapWord* base_address) :
 260     _region_bm(live_data->live_regions_bm()),
 261     _card_bm(live_data->live_cards_bm()) {
 262     // Calculate the card number for the bottom of the heap. Used
 263     // in biasing indexes into the accounting card bitmaps.
 264     _heap_card_bias =
 265       uintptr_t(base_address) >> CardTableModRefBS::card_shift;
 266   }
 267 };
 268 
 269 class G1CreateCardLiveDataTask: public AbstractGangTask {
 270   // Aggregate the counting data that was constructed concurrently
 271   // with marking.
 272   class G1CreateLiveDataClosure : public HeapRegionClosure {
 273     G1CardLiveDataHelper _helper;




 204   }
 205 
 206   // Mark the range of bits covered by live objects on the mark bitmap between
 207   // bottom and NTAMS of the given region.
 208   // Returns the number of live bytes marked within that area for the given
 209   // heap region.
 210   size_t mark_marked_during_marking(G1CMBitMap* mark_bitmap, HeapRegion* hr) {
 211     reset_mark_cache();
 212 
 213     size_t marked_bytes = 0;
 214 
 215     HeapWord* ntams = hr->next_top_at_mark_start();
 216     HeapWord* start = hr->bottom();
 217 
 218     if (ntams <= start) {
 219       // Skip empty regions.
 220       return 0;
 221     }
 222     if (hr->is_humongous()) {
 223       HeapRegion* start_region = hr->humongous_start_region();
 224       if (mark_bitmap->is_marked(start_region->bottom())) {
 225         mark_card_bitmap_range(start, hr->top());
 226         return pointer_delta(hr->top(), start, 1);
 227       } else {
 228         // Humongous start object was actually dead.
 229         return 0;
 230       }
 231     }
 232 
 233     assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
 234            "Preconditions not met - "
 235            "start: " PTR_FORMAT ", ntams: " PTR_FORMAT ", end: " PTR_FORMAT,
 236            p2i(start), p2i(ntams), p2i(hr->end()));
 237 
 238     // Find the first marked object at or after "start".
 239     start = mark_bitmap->get_next_marked_addr(start, ntams);
 240     while (start < ntams) {
 241       oop obj = oop(start);
 242       size_t obj_size = obj->size();
 243       HeapWord* obj_end = start + obj_size;
 244 
 245       assert(obj_end <= hr->end(), "Humongous objects must have been handled elsewhere.");
 246 
 247       mark_card_bitmap_range(start, obj_end);
 248 
 249       // Add the size of this object to the number of marked bytes.
 250       marked_bytes += obj_size * HeapWordSize;
 251 
 252       // Find the next marked object after this one.
 253       start = mark_bitmap->get_next_marked_addr(obj_end, ntams);
 254     }
 255 
 256     return marked_bytes;
 257   }
 258 
 259   G1CardLiveDataHelper(G1CardLiveData* live_data, HeapWord* base_address) :
 260     _region_bm(live_data->live_regions_bm()),
 261     _card_bm(live_data->live_cards_bm()) {
 262     // Calculate the card number for the bottom of the heap. Used
 263     // in biasing indexes into the accounting card bitmaps.
 264     _heap_card_bias =
 265       uintptr_t(base_address) >> CardTableModRefBS::card_shift;
 266   }
 267 };
 268 
 269 class G1CreateCardLiveDataTask: public AbstractGangTask {
 270   // Aggregate the counting data that was constructed concurrently
 271   // with marking.
 272   class G1CreateLiveDataClosure : public HeapRegionClosure {
 273     G1CardLiveDataHelper _helper;


< prev index next >