--- old/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2014-06-26 13:28:22.017134669 +0200 +++ new/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2014-06-26 13:28:21.929134666 +0200 @@ -109,9 +109,9 @@ if (loc_hr->is_in_reserved_raw(from)) { size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom()); CardIdx_t from_card = (CardIdx_t) - hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize); + (hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize)); - assert(0 <= from_card && (size_t)from_card < HeapRegion::CardsPerRegion, + assert((size_t)from_card < HeapRegion::CardsPerRegion, "Must be in range."); add_card_work(from_card, par); } @@ -471,7 +471,7 @@ uintptr_t(from_hr->bottom()) >> CardTableModRefBS::card_shift; CardIdx_t card_index = from_card - from_hr_bot_card_index; - assert(0 <= card_index && (size_t)card_index < HeapRegion::CardsPerRegion, + assert((size_t)card_index < HeapRegion::CardsPerRegion, "Must be in range."); if (G1HRRSUseSparseTable && _sparse_table.add_card(from_hrs_ind, card_index)) { @@ -517,11 +517,9 @@ // Transfer from sparse to fine-grain. SparsePRTEntry *sprt_entry = _sparse_table.get_entry(from_hrs_ind); assert(sprt_entry != NULL, "There should have been an entry"); - for (int i = 0; i < SparsePRTEntry::cards_num(); i++) { + for (int i = 0; i < sprt_entry->num_valid_cards(); i++) { CardIdx_t c = sprt_entry->card(i); - if (c != SparsePRTEntry::NullEntry) { - prt->add_card(c); - } + prt->add_card(c); } // Now we can delete the sparse entry. bool res = _sparse_table.delete_entry(from_hrs_ind); @@ -815,7 +813,7 @@ uintptr_t(hr->bottom()) >> CardTableModRefBS::card_shift; assert(from_card >= hr_bot_card_index, "Inv"); CardIdx_t card_index = from_card - hr_bot_card_index; - assert(0 <= card_index && (size_t)card_index < HeapRegion::CardsPerRegion, + assert((size_t)card_index < HeapRegion::CardsPerRegion, "Must be in range."); return _sparse_table.contains_card(hr_ind, card_index); }