260 |
260 |
261 #if 0 |
261 #if 0 |
262 virtual void cleanup() = 0; |
262 virtual void cleanup() = 0; |
263 #endif |
263 #endif |
264 |
264 |
265 // Should be called from single-threaded code. |
|
266 void init_for_par_iteration(); |
|
267 // Attempt to claim the region. Returns true iff this call caused an |
265 // Attempt to claim the region. Returns true iff this call caused an |
268 // atomic transition from Unclaimed to Claimed. |
266 // atomic transition from Unclaimed to Claimed. |
269 bool claim_iter(); |
267 bool claim_iter(); |
270 // Sets the iteration state to "complete". |
268 // Sets the iteration state to "complete". |
271 void set_iter_complete(); |
269 void set_iter_complete(); |
272 // Returns "true" iff the region's iteration is complete. |
270 // Returns "true" iff the region's iteration is complete. |
273 bool iter_is_complete(); |
271 bool iter_is_complete(); |
274 |
272 |
275 // Support for claiming blocks of cards during iteration |
273 // Support for claiming blocks of cards during iteration |
276 void set_iter_claimed(size_t x) { _iter_claimed = (jlong)x; } |
|
277 size_t iter_claimed() const { return (size_t)_iter_claimed; } |
274 size_t iter_claimed() const { return (size_t)_iter_claimed; } |
278 // Claim the next block of cards |
275 // Claim the next block of cards |
279 size_t iter_claimed_next(size_t step) { |
276 size_t iter_claimed_next(size_t step) { |
280 size_t current, next; |
277 size_t current, next; |
281 do { |
278 do { |
282 current = iter_claimed(); |
279 current = iter_claimed(); |
283 next = current + step; |
280 next = current + step; |
284 } while (Atomic::cmpxchg((jlong)next, &_iter_claimed, (jlong)current) != (jlong)current); |
281 } while (Atomic::cmpxchg((jlong)next, &_iter_claimed, (jlong)current) != (jlong)current); |
285 return current; |
282 return current; |
286 } |
283 } |
|
284 void reset_for_par_iteration(); |
|
285 |
|
286 bool verify_ready_for_par_iteration() { |
|
287 return (_iter_state == Unclaimed) && (_iter_claimed == 0); |
|
288 } |
287 |
289 |
288 // Initialize the given iterator to iterate over this rem set. |
290 // Initialize the given iterator to iterate over this rem set. |
289 void init_iterator(HeapRegionRemSetIterator* iter) const; |
291 void init_iterator(HeapRegionRemSetIterator* iter) const; |
290 |
292 |
291 #if 0 |
293 #if 0 |