@@ -534,6 +534,7 @@ void ParallelCompactData::add_obj(HeapWord* addr, size_t len)
534534{
535535 const size_t obj_ofs = pointer_delta (addr, _region_start);
536536 const size_t beg_region = obj_ofs >> Log2RegionSize;
537+ // end_region is inclusive
537538 const size_t end_region = (obj_ofs + len - 1 ) >> Log2RegionSize;
538539
539540 DEBUG_ONLY (Atomic::inc (&add_obj_count);)
@@ -549,7 +550,6 @@ void ParallelCompactData::add_obj(HeapWord* addr, size_t len)
549550 const size_t beg_ofs = region_offset (addr);
550551 _region_data[beg_region].add_live_obj (RegionSize - beg_ofs);
551552
552- Klass* klass = cast_to_oop (addr)->klass ();
553553 // Middle regions--completely spanned by this object.
554554 for (size_t region = beg_region + 1 ; region < end_region; ++region) {
555555 _region_data[region].set_partial_obj_size (RegionSize);
@@ -565,8 +565,8 @@ void ParallelCompactData::add_obj(HeapWord* addr, size_t len)
565565void
566566ParallelCompactData::summarize_dense_prefix (HeapWord* beg, HeapWord* end)
567567{
568- assert (region_offset (beg) == 0 , " not RegionSize aligned" );
569- assert (region_offset (end) == 0 , " not RegionSize aligned" );
568+ assert (is_region_aligned (beg), " not RegionSize aligned" );
569+ assert (is_region_aligned (end), " not RegionSize aligned" );
570570
571571 size_t cur_region = addr_to_region_idx (beg);
572572 const size_t end_region = addr_to_region_idx (end);
@@ -762,7 +762,7 @@ bool ParallelCompactData::summarize(SplitInfo& split_info,
762762 destination_count += 1 ;
763763 // Data from cur_region will be copied to the start of dest_region_2.
764764 _region_data[dest_region_2].set_source_region (cur_region);
765- } else if (region_offset (dest_addr) == 0 ) {
765+ } else if (is_region_aligned (dest_addr)) {
766766 // Data from cur_region will be copied to the start of the destination
767767 // region.
768768 _region_data[dest_region_1].set_source_region (cur_region);
0 commit comments