comparison src/share/vm/gc_implementation/g1/sparsePRT.hpp @ 1884:9f4848ebbabd

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
author tonyp
date Fri, 15 Oct 2010 17:26:56 -0400
parents c18cbe5936b8
children 72a161e62cc4
comparison
equal deleted inserted replaced
1883:35e4e086d5f5 1884:9f4848ebbabd
167 class RSHashTableIter VALUE_OBJ_CLASS_SPEC { 167 class RSHashTableIter VALUE_OBJ_CLASS_SPEC {
168 int _tbl_ind; // [-1, 0.._rsht->_capacity) 168 int _tbl_ind; // [-1, 0.._rsht->_capacity)
169 int _bl_ind; // [-1, 0.._rsht->_capacity) 169 int _bl_ind; // [-1, 0.._rsht->_capacity)
170 short _card_ind; // [0..SparsePRTEntry::cards_num()) 170 short _card_ind; // [0..SparsePRTEntry::cards_num())
171 RSHashTable* _rsht; 171 RSHashTable* _rsht;
172 size_t _heap_bot_card_ind;
173 172
174 // If the bucket list pointed to by _bl_ind contains a card, sets 173 // If the bucket list pointed to by _bl_ind contains a card, sets
175 // _bl_ind to the index of that entry, and returns the card. 174 // _bl_ind to the index of that entry, and returns the card.
176 // Otherwise, returns SparseEntry::NullEntry. 175 // Otherwise, returns SparseEntry::NullEntry.
177 CardIdx_t find_first_card_in_list(); 176 CardIdx_t find_first_card_in_list();
181 // This is subject to errors when there is iteration concurrent with 180 // This is subject to errors when there is iteration concurrent with
182 // modification, but these errors should be benign. 181 // modification, but these errors should be benign.
183 size_t compute_card_ind(CardIdx_t ci); 182 size_t compute_card_ind(CardIdx_t ci);
184 183
185 public: 184 public:
186 RSHashTableIter(size_t heap_bot_card_ind) : 185 RSHashTableIter() :
187 _tbl_ind(RSHashTable::NullEntry), 186 _tbl_ind(RSHashTable::NullEntry),
188 _bl_ind(RSHashTable::NullEntry), 187 _bl_ind(RSHashTable::NullEntry),
189 _card_ind((SparsePRTEntry::cards_num() - 1)), 188 _card_ind((SparsePRTEntry::cards_num() - 1)),
190 _rsht(NULL), 189 _rsht(NULL) {}
191 _heap_bot_card_ind(heap_bot_card_ind)
192 {}
193 190
194 void init(RSHashTable* rsht) { 191 void init(RSHashTable* rsht) {
195 _rsht = rsht; 192 _rsht = rsht;
196 _tbl_ind = -1; // So that first increment gets to 0. 193 _tbl_ind = -1; // So that first increment gets to 0.
197 _bl_ind = RSHashTable::NullEntry; 194 _bl_ind = RSHashTable::NullEntry;
278 static SparsePRT* get_from_expanded_list(); 275 static SparsePRT* get_from_expanded_list();
279 276
280 bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const { 277 bool contains_card(RegionIdx_t region_id, CardIdx_t card_index) const {
281 return _next->contains_card(region_id, card_index); 278 return _next->contains_card(region_id, card_index);
282 } 279 }
283 280 };
284 #if 0 281
285 void verify_is_cleared(); 282
286 void print(); 283 class SparsePRTIter: public RSHashTableIter {
287 #endif 284 public:
288 }; 285 SparsePRTIter() : RSHashTableIter() { }
289
290
291 class SparsePRTIter: public /* RSHashTable:: */RSHashTableIter {
292 public:
293 SparsePRTIter(size_t heap_bot_card_ind) :
294 /* RSHashTable:: */RSHashTableIter(heap_bot_card_ind)
295 {}
296 286
297 void init(const SparsePRT* sprt) { 287 void init(const SparsePRT* sprt) {
298 RSHashTableIter::init(sprt->cur()); 288 RSHashTableIter::init(sprt->cur());
299 } 289 }
300 bool has_next(size_t& card_index) { 290 bool has_next(size_t& card_index) {