src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc_implementation/g1

src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp

Print this page
rev 5732 : [mq]: comments2


  88   size_t region_size_bytes = mr.byte_size();
  89   uint index = hr->hrs_index();
  90 
  91   assert(!hr->continuesHumongous(), "should not be HC region");
  92   assert(hr == g1h->heap_region_containing(start), "sanity");
  93   assert(hr == g1h->heap_region_containing(mr.last()), "sanity");
  94   assert(marked_bytes_array != NULL, "pre-condition");
  95   assert(task_card_bm != NULL, "pre-condition");
  96 
  97   // Add to the task local marked bytes for this region.
  98   marked_bytes_array[index] += region_size_bytes;
  99 
 100   BitMap::idx_t start_idx = card_bitmap_index_for(start);
 101   BitMap::idx_t end_idx = card_bitmap_index_for(end);
 102 
 103   // Note: if we're looking at the last region in heap - end
 104   // could be actually just beyond the end of the heap; end_idx
 105   // will then correspond to a (non-existent) card that is also
 106   // just beyond the heap.
 107   if (g1h->is_in_g1_reserved(end) && !ct_bs->is_card_aligned(end)) {
 108     // end of region is not card aligned - incremement to cover
 109     // all the cards spanned by the region.
 110     end_idx += 1;
 111   }
 112   // The card bitmap is task/worker specific => no need to use
 113   // the 'par' BitMap routines.
 114   // Set bits in the exclusive bit range [start_idx, end_idx).
 115   set_card_bitmap_range(task_card_bm, start_idx, end_idx, false /* is_par */);
 116 }
 117 
 118 // Counts the given memory region in the task/worker counting
 119 // data structures for the given worker id.
 120 inline void ConcurrentMark::count_region(MemRegion mr,
 121                                          HeapRegion* hr,
 122                                          uint worker_id) {
 123   size_t* marked_bytes_array = count_marked_bytes_array_for(worker_id);
 124   BitMap* task_card_bm = count_card_bitmap_for(worker_id);
 125   count_region(mr, hr, marked_bytes_array, task_card_bm);
 126 }
 127 
 128 // Counts the given memory region, which may be a single object, in the


 205   HeapWord* addr = (HeapWord*)obj;
 206   HeapRegion* hr = _g1h->heap_region_containing_raw(addr);
 207   return par_mark_and_count(obj, hr, worker_id);
 208 }
 209 
 210 // Similar to the above routine but we already know the size, in words, of
 211 // the object that we wish to mark/count
 212 inline bool ConcurrentMark::par_mark_and_count(oop obj,
 213                                                size_t word_size,
 214                                                uint worker_id) {
 215   HeapWord* addr = (HeapWord*)obj;
 216   if (_nextMarkBitMap->parMark(addr)) {
 217     // Update the task specific count data for the object.
 218     MemRegion mr(addr, word_size);
 219     count_region(mr, worker_id);
 220     return true;
 221   }
 222   return false;
 223 }
 224 
 225 // Unconditionally mark the given object, and unconditinally count
 226 // the object in the counting structures for worker id 0.
 227 // Should *not* be called from parallel code.
 228 inline bool ConcurrentMark::mark_and_count(oop obj, HeapRegion* hr) {
 229   HeapWord* addr = (HeapWord*)obj;
 230   _nextMarkBitMap->mark(addr);
 231   // Update the task specific count data for the object.
 232   count_object(obj, hr, 0 /* worker_id */);
 233   return true;
 234 }
 235 
 236 // As above - but we don't have the heap region containing the
 237 // object, so we have to supply it.
 238 inline bool ConcurrentMark::mark_and_count(oop obj) {
 239   HeapWord* addr = (HeapWord*)obj;
 240   HeapRegion* hr = _g1h->heap_region_containing_raw(addr);
 241   return mark_and_count(obj, hr);
 242 }
 243 
 244 inline bool CMBitMapRO::iterate(BitMapClosure* cl, MemRegion mr) {
 245   HeapWord* start_addr = MAX2(startWord(), mr.start());




  88   size_t region_size_bytes = mr.byte_size();
  89   uint index = hr->hrs_index();
  90 
  91   assert(!hr->continuesHumongous(), "should not be HC region");
  92   assert(hr == g1h->heap_region_containing(start), "sanity");
  93   assert(hr == g1h->heap_region_containing(mr.last()), "sanity");
  94   assert(marked_bytes_array != NULL, "pre-condition");
  95   assert(task_card_bm != NULL, "pre-condition");
  96 
  97   // Add to the task local marked bytes for this region.
  98   marked_bytes_array[index] += region_size_bytes;
  99 
 100   BitMap::idx_t start_idx = card_bitmap_index_for(start);
 101   BitMap::idx_t end_idx = card_bitmap_index_for(end);
 102 
 103   // Note: if we're looking at the last region in heap - end
 104   // could be actually just beyond the end of the heap; end_idx
 105   // will then correspond to a (non-existent) card that is also
 106   // just beyond the heap.
 107   if (g1h->is_in_g1_reserved(end) && !ct_bs->is_card_aligned(end)) {
 108     // end of region is not card aligned - increment to cover
 109     // all the cards spanned by the region.
 110     end_idx += 1;
 111   }
 112   // The card bitmap is task/worker specific => no need to use
 113   // the 'par' BitMap routines.
 114   // Set bits in the exclusive bit range [start_idx, end_idx).
 115   set_card_bitmap_range(task_card_bm, start_idx, end_idx, false /* is_par */);
 116 }
 117 
 118 // Counts the given memory region in the task/worker counting
 119 // data structures for the given worker id.
 120 inline void ConcurrentMark::count_region(MemRegion mr,
 121                                          HeapRegion* hr,
 122                                          uint worker_id) {
 123   size_t* marked_bytes_array = count_marked_bytes_array_for(worker_id);
 124   BitMap* task_card_bm = count_card_bitmap_for(worker_id);
 125   count_region(mr, hr, marked_bytes_array, task_card_bm);
 126 }
 127 
 128 // Counts the given memory region, which may be a single object, in the


 205   HeapWord* addr = (HeapWord*)obj;
 206   HeapRegion* hr = _g1h->heap_region_containing_raw(addr);
 207   return par_mark_and_count(obj, hr, worker_id);
 208 }
 209 
 210 // Similar to the above routine but we already know the size, in words, of
 211 // the object that we wish to mark/count
 212 inline bool ConcurrentMark::par_mark_and_count(oop obj,
 213                                                size_t word_size,
 214                                                uint worker_id) {
 215   HeapWord* addr = (HeapWord*)obj;
 216   if (_nextMarkBitMap->parMark(addr)) {
 217     // Update the task specific count data for the object.
 218     MemRegion mr(addr, word_size);
 219     count_region(mr, worker_id);
 220     return true;
 221   }
 222   return false;
 223 }
 224 
 225 // Unconditionally mark the given object, and unconditionally count
 226 // the object in the counting structures for worker id 0.
 227 // Should *not* be called from parallel code.
 228 inline bool ConcurrentMark::mark_and_count(oop obj, HeapRegion* hr) {
 229   HeapWord* addr = (HeapWord*)obj;
 230   _nextMarkBitMap->mark(addr);
 231   // Update the task specific count data for the object.
 232   count_object(obj, hr, 0 /* worker_id */);
 233   return true;
 234 }
 235 
 236 // As above - but we don't have the heap region containing the
 237 // object, so we have to supply it.
 238 inline bool ConcurrentMark::mark_and_count(oop obj) {
 239   HeapWord* addr = (HeapWord*)obj;
 240   HeapRegion* hr = _g1h->heap_region_containing_raw(addr);
 241   return mark_and_count(obj, hr);
 242 }
 243 
 244 inline bool CMBitMapRO::iterate(BitMapClosure* cl, MemRegion mr) {
 245   HeapWord* start_addr = MAX2(startWord(), mr.start());


src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File