提交 7cdb73a5 编写于 作者: T tonyp

6992189: G1: inconsistent base used in sparse rem set iterator

Summary: The remembered set iterator for sparse tables incorrectly assumes that index 0 corresponds to the bottom of the heap, not address 0 as it is the case.
Reviewed-by: ysr, jmasa
上级 5268acc4
...@@ -1159,9 +1159,7 @@ HeapRegionRemSetIterator() : ...@@ -1159,9 +1159,7 @@ HeapRegionRemSetIterator() :
_hrrs(NULL), _hrrs(NULL),
_g1h(G1CollectedHeap::heap()), _g1h(G1CollectedHeap::heap()),
_bosa(NULL), _bosa(NULL),
_sparse_iter(size_t(G1CollectedHeap::heap()->reserved_region().start()) _sparse_iter() { }
>> CardTableModRefBS::card_shift)
{}
void HeapRegionRemSetIterator::initialize(const HeapRegionRemSet* hrrs) { void HeapRegionRemSetIterator::initialize(const HeapRegionRemSet* hrrs) {
_hrrs = hrrs; _hrrs = hrrs;
......
...@@ -323,10 +323,7 @@ CardIdx_t /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() { ...@@ -323,10 +323,7 @@ CardIdx_t /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() {
} }
size_t /* RSHashTable:: */ RSHashTableIter::compute_card_ind(CardIdx_t ci) { size_t /* RSHashTable:: */ RSHashTableIter::compute_card_ind(CardIdx_t ci) {
return return (_rsht->entry(_bl_ind)->r_ind() * HeapRegion::CardsPerRegion) + ci;
_heap_bot_card_ind
+ (_rsht->entry(_bl_ind)->r_ind() * HeapRegion::CardsPerRegion)
+ ci;
} }
bool /* RSHashTable:: */ RSHashTableIter::has_next(size_t& card_index) { bool /* RSHashTable:: */ RSHashTableIter::has_next(size_t& card_index) {
......
...@@ -169,7 +169,6 @@ class RSHashTableIter VALUE_OBJ_CLASS_SPEC { ...@@ -169,7 +169,6 @@ class RSHashTableIter VALUE_OBJ_CLASS_SPEC {
int _bl_ind; // [-1, 0.._rsht->_capacity) int _bl_ind; // [-1, 0.._rsht->_capacity)
short _card_ind; // [0..SparsePRTEntry::cards_num()) short _card_ind; // [0..SparsePRTEntry::cards_num())
RSHashTable* _rsht; RSHashTable* _rsht;
size_t _heap_bot_card_ind;
// If the bucket list pointed to by _bl_ind contains a card, sets // If the bucket list pointed to by _bl_ind contains a card, sets
// _bl_ind to the index of that entry, and returns the card. // _bl_ind to the index of that entry, and returns the card.
...@@ -183,13 +182,11 @@ class RSHashTableIter VALUE_OBJ_CLASS_SPEC { ...@@ -183,13 +182,11 @@ class RSHashTableIter VALUE_OBJ_CLASS_SPEC {
size_t compute_card_ind(CardIdx_t ci); size_t compute_card_ind(CardIdx_t ci);
public: public:
RSHashTableIter(size_t heap_bot_card_ind) : RSHashTableIter() :
_tbl_ind(RSHashTable::NullEntry), _tbl_ind(RSHashTable::NullEntry),
_bl_ind(RSHashTable::NullEntry), _bl_ind(RSHashTable::NullEntry),
_card_ind((SparsePRTEntry::cards_num() - 1)), _card_ind((SparsePRTEntry::cards_num() - 1)),
_rsht(NULL), _rsht(NULL) {}
_heap_bot_card_ind(heap_bot_card_ind)
{}
void init(RSHashTable* rsht) { void init(RSHashTable* rsht) {
_rsht = rsht; _rsht = rsht;
...@@ -280,19 +277,12 @@ public: ...@@ -280,19 +277,12 @@ public:
bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const { bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const {
return _next->contains_card(region_id, card_index); return _next->contains_card(region_id, card_index);
} }
#if 0
void verify_is_cleared();
void print();
#endif
}; };
class SparsePRTIter: public /* RSHashTable:: */RSHashTableIter { class SparsePRTIter: public RSHashTableIter {
public: public:
SparsePRTIter(size_t heap_bot_card_ind) : SparsePRTIter() : RSHashTableIter() { }
/* RSHashTable:: */RSHashTableIter(heap_bot_card_ind)
{}
void init(const SparsePRT* sprt) { void init(const SparsePRT* sprt) {
RSHashTableIter::init(sprt->cur()); RSHashTableIter::init(sprt->cur());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册