190 // This is subject to errors when there is iteration concurrent with |
190 // This is subject to errors when there is iteration concurrent with |
191 // modification, but these errors should be benign. |
191 // modification, but these errors should be benign. |
192 size_t compute_card_ind(CardIdx_t ci); |
192 size_t compute_card_ind(CardIdx_t ci); |
193 |
193 |
194 public: |
194 public: |
195 RSHashTableIter() : |
195 RSHashTableIter(RSHashTable* rsht) : |
196 _tbl_ind(RSHashTable::NullEntry), |
196 _tbl_ind(RSHashTable::NullEntry), // So that first increment gets to 0. |
197 _bl_ind(RSHashTable::NullEntry), |
197 _bl_ind(RSHashTable::NullEntry), |
198 _card_ind((SparsePRTEntry::cards_num() - 1)), |
198 _card_ind((SparsePRTEntry::cards_num() - 1)), |
199 _rsht(NULL) {} |
199 _rsht(rsht) {} |
200 |
|
201 void init(RSHashTable* rsht) { |
|
202 _rsht = rsht; |
|
203 _tbl_ind = -1; // So that first increment gets to 0. |
|
204 _bl_ind = RSHashTable::NullEntry; |
|
205 _card_ind = (SparsePRTEntry::cards_num() - 1); |
|
206 } |
|
207 |
200 |
208 bool has_next(size_t& card_index); |
201 bool has_next(size_t& card_index); |
209 }; |
202 }; |
210 |
203 |
211 // Concurrent accesss to a SparsePRT must be serialized by some external |
204 // Concurrent accesss to a SparsePRT must be serialized by some external |
281 void cleanup(); |
274 void cleanup(); |
282 |
275 |
283 // Clean up all tables on the expanded list. Called single threaded. |
276 // Clean up all tables on the expanded list. Called single threaded. |
284 static void cleanup_all(); |
277 static void cleanup_all(); |
285 RSHashTable* cur() const { return _cur; } |
278 RSHashTable* cur() const { return _cur; } |
286 |
|
287 void init_iterator(SparsePRTIter* sprt_iter); |
|
288 |
279 |
289 static void add_to_expanded_list(SparsePRT* sprt); |
280 static void add_to_expanded_list(SparsePRT* sprt); |
290 static SparsePRT* get_from_expanded_list(); |
281 static SparsePRT* get_from_expanded_list(); |
291 |
282 |
292 // The purpose of these three methods is to help the GC workers |
283 // The purpose of these three methods is to help the GC workers |
319 } |
310 } |
320 }; |
311 }; |
321 |
312 |
322 class SparsePRTIter: public RSHashTableIter { |
313 class SparsePRTIter: public RSHashTableIter { |
323 public: |
314 public: |
324 void init(const SparsePRT* sprt) { |
315 SparsePRTIter(const SparsePRT* sprt) : |
325 RSHashTableIter::init(sprt->cur()); |
316 RSHashTableIter(sprt->cur()) {} |
326 } |
317 |
327 bool has_next(size_t& card_index) { |
318 bool has_next(size_t& card_index) { |
328 return RSHashTableIter::has_next(card_index); |
319 return RSHashTableIter::has_next(card_index); |
329 } |
320 } |
330 }; |
321 }; |
331 |
322 |