2601 } |
2601 } |
2602 } |
2602 } |
2603 |
2603 |
2604 // Iteration functions. |
2604 // Iteration functions. |
2605 |
2605 |
2606 // Iterates an OopClosure over all ref-containing fields of objects |
2606 // Applies an ExtendedOopClosure onto all references of objects within a HeapRegion. |
2607 // within a HeapRegion. |
|
2608 |
2607 |
2609 class IterateOopClosureRegionClosure: public HeapRegionClosure { |
2608 class IterateOopClosureRegionClosure: public HeapRegionClosure { |
2610 MemRegion _mr; |
|
2611 ExtendedOopClosure* _cl; |
2609 ExtendedOopClosure* _cl; |
2612 public: |
2610 public: |
2613 IterateOopClosureRegionClosure(MemRegion mr, ExtendedOopClosure* cl) |
2611 IterateOopClosureRegionClosure(ExtendedOopClosure* cl) : _cl(cl) {} |
2614 : _mr(mr), _cl(cl) {} |
|
2615 bool doHeapRegion(HeapRegion* r) { |
2612 bool doHeapRegion(HeapRegion* r) { |
2616 if (!r->continuesHumongous()) { |
2613 if (!r->continuesHumongous()) { |
2617 r->oop_iterate(_cl); |
2614 r->oop_iterate(_cl); |
2618 } |
2615 } |
2619 return false; |
2616 return false; |
2620 } |
2617 } |
2621 }; |
2618 }; |
2622 |
2619 |
2623 void G1CollectedHeap::oop_iterate(ExtendedOopClosure* cl) { |
2620 void G1CollectedHeap::oop_iterate(ExtendedOopClosure* cl) { |
2624 IterateOopClosureRegionClosure blk(_g1_committed, cl); |
2621 IterateOopClosureRegionClosure blk(cl); |
2625 heap_region_iterate(&blk); |
|
2626 } |
|
2627 |
|
2628 void G1CollectedHeap::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) { |
|
2629 IterateOopClosureRegionClosure blk(mr, cl); |
|
2630 heap_region_iterate(&blk); |
2622 heap_region_iterate(&blk); |
2631 } |
2623 } |
2632 |
2624 |
2633 // Iterates an ObjectClosure over all objects within a HeapRegion. |
2625 // Iterates an ObjectClosure over all objects within a HeapRegion. |
2634 |
2626 |
4825 ParallelTaskTerminator _terminator; |
4817 ParallelTaskTerminator _terminator; |
4826 uint _n_workers; |
4818 uint _n_workers; |
4827 |
4819 |
4828 Mutex _stats_lock; |
4820 Mutex _stats_lock; |
4829 Mutex* stats_lock() { return &_stats_lock; } |
4821 Mutex* stats_lock() { return &_stats_lock; } |
4830 |
|
4831 size_t getNCards() { |
|
4832 return (_g1h->capacity() + G1BlockOffsetSharedArray::N_bytes - 1) |
|
4833 / G1BlockOffsetSharedArray::N_bytes; |
|
4834 } |
|
4835 |
4822 |
4836 public: |
4823 public: |
4837 G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues) |
4824 G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues) |
4838 : AbstractGangTask("G1 collection"), |
4825 : AbstractGangTask("G1 collection"), |
4839 _g1h(g1h), |
4826 _g1h(g1h), |