Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp @ 10182:5c93c1f61226
8011724: G1: Stack allocate instances of HeapRegionRemSetIterator
Summary: Stack allocate instances of HeapRegionRemSetIterator during RSet scanning.
Reviewed-by: brutisso, jwilhelm
author | johnc |
---|---|
date | Thu, 18 Apr 2013 10:09:23 -0700 |
parents | db823a892a55 |
children | 6702da6b6082 |
comparison
equal
deleted
inserted
replaced
10181:1cb4795305b9 | 10182:5c93c1f61226 |
---|---|
279 | 279 |
280 bool verify_ready_for_par_iteration() { | 280 bool verify_ready_for_par_iteration() { |
281 return (_iter_state == Unclaimed) && (_iter_claimed == 0); | 281 return (_iter_state == Unclaimed) && (_iter_claimed == 0); |
282 } | 282 } |
283 | 283 |
284 // Initialize the given iterator to iterate over this rem set. | |
285 void init_iterator(HeapRegionRemSetIterator* iter) const; | |
286 | |
287 // The actual # of bytes this hr_remset takes up. | 284 // The actual # of bytes this hr_remset takes up. |
288 size_t mem_size() { | 285 size_t mem_size() { |
289 return _other_regions.mem_size() | 286 return _other_regions.mem_size() |
290 // This correction is necessary because the above includes the second | 287 // This correction is necessary because the above includes the second |
291 // part. | 288 // part. |
343 #ifndef PRODUCT | 340 #ifndef PRODUCT |
344 static void test(); | 341 static void test(); |
345 #endif | 342 #endif |
346 }; | 343 }; |
347 | 344 |
348 class HeapRegionRemSetIterator : public CHeapObj<mtGC> { | 345 class HeapRegionRemSetIterator : public StackObj { |
349 | 346 |
350 // The region over which we're iterating. | 347 // The region RSet over which we're iterating. |
351 const HeapRegionRemSet* _hrrs; | 348 const HeapRegionRemSet* _hrrs; |
352 | 349 |
353 // Local caching of HRRS fields. | 350 // Local caching of HRRS fields. |
354 const BitMap* _coarse_map; | 351 const BitMap* _coarse_map; |
355 PerRegionTable** _fine_grain_regions; | 352 PerRegionTable** _fine_grain_regions; |
360 // The number yielded since initialization. | 357 // The number yielded since initialization. |
361 size_t _n_yielded_fine; | 358 size_t _n_yielded_fine; |
362 size_t _n_yielded_coarse; | 359 size_t _n_yielded_coarse; |
363 size_t _n_yielded_sparse; | 360 size_t _n_yielded_sparse; |
364 | 361 |
365 // If true we're iterating over the coarse table; if false the fine | 362 // Indicates what granularity of table that we're currently iterating over. |
366 // table. | 363 // We start iterating over the sparse table, progress to the fine grain |
364 // table, and then finish with the coarse table. | |
365 // See HeapRegionRemSetIterator::has_next(). | |
367 enum IterState { | 366 enum IterState { |
368 Sparse, | 367 Sparse, |
369 Fine, | 368 Fine, |
370 Coarse | 369 Coarse |
371 }; | 370 }; |
401 bool fine_has_next(size_t& card_index); | 400 bool fine_has_next(size_t& card_index); |
402 | 401 |
403 public: | 402 public: |
404 // We require an iterator to be initialized before use, so the | 403 // We require an iterator to be initialized before use, so the |
405 // constructor does little. | 404 // constructor does little. |
406 HeapRegionRemSetIterator(); | 405 HeapRegionRemSetIterator(const HeapRegionRemSet* hrrs); |
407 | |
408 void initialize(const HeapRegionRemSet* hrrs); | |
409 | 406 |
410 // If there remains one or more cards to be yielded, returns true and | 407 // If there remains one or more cards to be yielded, returns true and |
411 // sets "card_index" to one of those cards (which is then considered | 408 // sets "card_index" to one of those cards (which is then considered |
412 // yielded.) Otherwise, returns false (and leaves "card_index" | 409 // yielded.) Otherwise, returns false (and leaves "card_index" |
413 // undefined.) | 410 // undefined.) |