Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp @ 20213:ff7b317d2af8
8037344: Use the "next" field to iterate over fine remembered instead of using the hash table
Summary: After changes to the PerRegionTable where all these PRTs are linked together in an additional field, simplify iterating over all PRTs by using these links instead of walki
Reviewed-by: mgerdin, jwilhelm, brutisso
author | tschatzl |
---|---|
date | Mon, 21 Jul 2014 09:40:19 +0200 |
parents | 82693fb204a5 |
children | 8cc89a893545 |
comparison
equal
deleted
inserted
replaced
20212:d7e2d5f2846b | 20213:ff7b317d2af8 |
---|---|
430 static void test(); | 430 static void test(); |
431 #endif | 431 #endif |
432 }; | 432 }; |
433 | 433 |
434 class HeapRegionRemSetIterator : public StackObj { | 434 class HeapRegionRemSetIterator : public StackObj { |
435 | 435 private: |
436 // The region RSet over which we're iterating. | 436 // The region RSet over which we are iterating. |
437 HeapRegionRemSet* _hrrs; | 437 HeapRegionRemSet* _hrrs; |
438 | 438 |
439 // Local caching of HRRS fields. | 439 // Local caching of HRRS fields. |
440 const BitMap* _coarse_map; | 440 const BitMap* _coarse_map; |
441 PerRegionTable** _fine_grain_regions; | |
442 | 441 |
443 G1BlockOffsetSharedArray* _bosa; | 442 G1BlockOffsetSharedArray* _bosa; |
444 G1CollectedHeap* _g1h; | 443 G1CollectedHeap* _g1h; |
445 | 444 |
446 // The number yielded since initialization. | 445 // The number of cards yielded since initialization. |
447 size_t _n_yielded_fine; | 446 size_t _n_yielded_fine; |
448 size_t _n_yielded_coarse; | 447 size_t _n_yielded_coarse; |
449 size_t _n_yielded_sparse; | 448 size_t _n_yielded_sparse; |
450 | 449 |
451 // Indicates what granularity of table that we're currently iterating over. | 450 // Indicates what granularity of table that we are currently iterating over. |
452 // We start iterating over the sparse table, progress to the fine grain | 451 // We start iterating over the sparse table, progress to the fine grain |
453 // table, and then finish with the coarse table. | 452 // table, and then finish with the coarse table. |
454 // See HeapRegionRemSetIterator::has_next(). | |
455 enum IterState { | 453 enum IterState { |
456 Sparse, | 454 Sparse, |
457 Fine, | 455 Fine, |
458 Coarse | 456 Coarse |
459 }; | 457 }; |
460 IterState _is; | 458 IterState _is; |
461 | 459 |
462 // In both kinds of iteration, heap offset of first card of current | 460 // For both Coarse and Fine remembered set iteration this contains the |
463 // region. | 461 // first card number of the heap region we currently iterate over. |
464 size_t _cur_region_card_offset; | 462 size_t _cur_region_card_offset; |
465 // Card offset within cur region. | 463 |
466 size_t _cur_region_cur_card; | 464 // Current region index for the Coarse remembered set iteration. |
467 | |
468 // Coarse table iteration fields: | |
469 | |
470 // Current region index; | |
471 int _coarse_cur_region_index; | 465 int _coarse_cur_region_index; |
472 size_t _coarse_cur_region_cur_card; | 466 size_t _coarse_cur_region_cur_card; |
473 | 467 |
474 bool coarse_has_next(size_t& card_index); | 468 bool coarse_has_next(size_t& card_index); |
475 | 469 |
476 // Fine table iteration fields: | 470 // The PRT we are currently iterating over. |
477 | |
478 // Index of bucket-list we're working on. | |
479 int _fine_array_index; | |
480 | |
481 // Per Region Table we're doing within current bucket list. | |
482 PerRegionTable* _fine_cur_prt; | 471 PerRegionTable* _fine_cur_prt; |
483 | 472 // Card offset within the current PRT. |
484 /* SparsePRT::*/ SparsePRTIter _sparse_iter; | 473 size_t _cur_card_in_prt; |
485 | 474 |
486 void fine_find_next_non_null_prt(); | 475 // Update internal variables when switching to the given PRT. |
487 | 476 void switch_to_prt(PerRegionTable* prt); |
488 bool fine_has_next(); | 477 bool fine_has_next(); |
489 bool fine_has_next(size_t& card_index); | 478 bool fine_has_next(size_t& card_index); |
490 | 479 |
491 public: | 480 // The Sparse remembered set iterator. |
492 // We require an iterator to be initialized before use, so the | 481 SparsePRTIter _sparse_iter; |
493 // constructor does little. | 482 |
483 public: | |
494 HeapRegionRemSetIterator(HeapRegionRemSet* hrrs); | 484 HeapRegionRemSetIterator(HeapRegionRemSet* hrrs); |
495 | 485 |
496 // If there remains one or more cards to be yielded, returns true and | 486 // If there remains one or more cards to be yielded, returns true and |
497 // sets "card_index" to one of those cards (which is then considered | 487 // sets "card_index" to one of those cards (which is then considered |
498 // yielded.) Otherwise, returns false (and leaves "card_index" | 488 // yielded.) Otherwise, returns false (and leaves "card_index" |