hotspot/src/share/vm/gc/shared/cardTableModRefBS.cpp
changeset 46618 d503911aa948
parent 42598 45562c0473fb
child 46619 a3919f5e8d2b
equal deleted inserted replaced
46617:0330c5fc49ce 46618:d503911aa948
   210     if (max_prev_end > cur_committed.end()) {
   210     if (max_prev_end > cur_committed.end()) {
   211       cur_committed.set_end(max_prev_end);
   211       cur_committed.set_end(max_prev_end);
   212     }
   212     }
   213     // Align the end up to a page size (starts are already aligned).
   213     // Align the end up to a page size (starts are already aligned).
   214     jbyte* const new_end = byte_after(new_region.last());
   214     jbyte* const new_end = byte_after(new_region.last());
   215     HeapWord* new_end_aligned =
   215     HeapWord* new_end_aligned = (HeapWord*) align_ptr_up(new_end, _page_size);
   216       (HeapWord*) align_size_up((uintptr_t)new_end, _page_size);
   216     assert((void*)new_end_aligned >= (void*) new_end, "align up, but less");
   217     assert(new_end_aligned >= (HeapWord*) new_end,
       
   218            "align up, but less");
       
   219     // Check the other regions (excludes "ind") to ensure that
   217     // Check the other regions (excludes "ind") to ensure that
   220     // the new_end_aligned does not intrude onto the committed
   218     // the new_end_aligned does not intrude onto the committed
   221     // space of another region.
   219     // space of another region.
   222     int ri = 0;
   220     int ri = 0;
   223     for (ri = ind + 1; ri < _cur_covered_regions; ri++) {
   221     for (ri = ind + 1; ri < _cur_covered_regions; ri++) {
   368   inline_write_ref_field(field, newVal, release);
   366   inline_write_ref_field(field, newVal, release);
   369 }
   367 }
   370 
   368 
   371 
   369 
   372 void CardTableModRefBS::dirty_MemRegion(MemRegion mr) {
   370 void CardTableModRefBS::dirty_MemRegion(MemRegion mr) {
   373   assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
   371   assert(align_ptr_down(mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
   374   assert((HeapWord*)align_size_up  ((uintptr_t)mr.end(),   HeapWordSize) == mr.end(),   "Unaligned end"  );
   372   assert(align_ptr_up  (mr.end(),   HeapWordSize) == mr.end(),   "Unaligned end"  );
   375   jbyte* cur  = byte_for(mr.start());
   373   jbyte* cur  = byte_for(mr.start());
   376   jbyte* last = byte_after(mr.last());
   374   jbyte* last = byte_after(mr.last());
   377   while (cur < last) {
   375   while (cur < last) {
   378     *cur = dirty_card;
   376     *cur = dirty_card;
   379     cur++;
   377     cur++;
   380   }
   378   }
   381 }
   379 }
   382 
   380 
   383 void CardTableModRefBS::invalidate(MemRegion mr) {
   381 void CardTableModRefBS::invalidate(MemRegion mr) {
   384   assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
   382   assert(align_ptr_down(mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
   385   assert((HeapWord*)align_size_up  ((uintptr_t)mr.end(),   HeapWordSize) == mr.end(),   "Unaligned end"  );
   383   assert(align_ptr_up  (mr.end(),   HeapWordSize) == mr.end(),   "Unaligned end"  );
   386   for (int i = 0; i < _cur_covered_regions; i++) {
   384   for (int i = 0; i < _cur_covered_regions; i++) {
   387     MemRegion mri = mr.intersection(_covered[i]);
   385     MemRegion mri = mr.intersection(_covered[i]);
   388     if (!mri.is_empty()) dirty_MemRegion(mri);
   386     if (!mri.is_empty()) dirty_MemRegion(mri);
   389   }
   387   }
   390 }
   388 }