src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
Print this page
rev 6583 : 8047328: Change typedef CardIdx_t from int to uint16_t
Summary: Changed the typedef and made the necessary changes to code interacting with the SparsePRTEntry class.
Reviewed-by:
Contributed-by: andreas.sjoberg@oracle.com
@@ -107,13 +107,13 @@
// make sure that we detect this. Thus, we call is_in_reserved_raw()
// instead of just is_in_reserved() here.
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);
}
}
@@ -469,11 +469,11 @@
uintptr_t from_hr_bot_card_index =
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)) {
if (G1RecordHRRSOops) {
HeapRegionRemSet::record(hr(), from);
@@ -515,16 +515,14 @@
if (G1HRRSUseSparseTable) {
// 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);
}
- }
// Now we can delete the sparse entry.
bool res = _sparse_table.delete_entry(from_hrs_ind);
assert(res, "It should have been there.");
}
}
@@ -813,11 +811,11 @@
(uintptr_t(from) >> CardTableModRefBS::card_shift);
uintptr_t hr_bot_card_index =
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);
}
}