src/share/vm/gc/g1/g1CollectorPolicy.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc/g1

src/share/vm/gc/g1/g1CollectorPolicy.cpp

Print this page




1548       // cannot wait for the marking thread to finish the cycle as it
1549       // periodically yields while clearing the next marking bitmap
1550       // and, if it's in a yield point, it's waiting for us to
1551       // finish. So, at this point we will not start a cycle and we'll
1552       // let the concurrent marking thread complete the last one.
1553       log_debug(gc, ergo)("Do not initiate concurrent cycle (concurrent cycle already in progress)");
1554     }
1555   }
1556 }
1557 
1558 class ParKnownGarbageHRClosure: public HeapRegionClosure {
1559   G1CollectedHeap* _g1h;
1560   CSetChooserParUpdater _cset_updater;
1561 
1562 public:
1563   ParKnownGarbageHRClosure(CollectionSetChooser* hrSorted,
1564                            uint chunk_size) :
1565     _g1h(G1CollectedHeap::heap()),
1566     _cset_updater(hrSorted, true /* parallel */, chunk_size) { }
1567 
1568   bool doHeapRegion(HeapRegion* r) {
1569     // Do we have any marking information for this region?
1570     if (r->is_marked()) {
1571       // We will skip any region that's currently used as an old GC
1572       // alloc region (we should not consider those for collection
1573       // before we fill them up).
1574       if (_cset_updater.should_add(r) && !_g1h->is_old_gc_alloc_region(r)) {
1575         _cset_updater.add_region(r);
1576       }
1577     }
1578     return false;
1579   }
1580 };
1581 
1582 class ParKnownGarbageTask: public AbstractGangTask {
1583   CollectionSetChooser* _hrSorted;
1584   uint _chunk_size;
1585   G1CollectedHeap* _g1;
1586   HeapRegionClaimer _hrclaimer;
1587 
1588 public:
1589   ParKnownGarbageTask(CollectionSetChooser* hrSorted, uint chunk_size, uint n_workers) :
1590       AbstractGangTask("ParKnownGarbageTask"),
1591       _hrSorted(hrSorted), _chunk_size(chunk_size),
1592       _g1(G1CollectedHeap::heap()), _hrclaimer(n_workers) {}
1593 
1594   void work(uint worker_id) {
1595     ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size);
1596     _g1->heap_region_par_iterate(&parKnownGarbageCl, worker_id, &_hrclaimer);
1597   }
1598 };




1548       // cannot wait for the marking thread to finish the cycle as it
1549       // periodically yields while clearing the next marking bitmap
1550       // and, if it's in a yield point, it's waiting for us to
1551       // finish. So, at this point we will not start a cycle and we'll
1552       // let the concurrent marking thread complete the last one.
1553       log_debug(gc, ergo)("Do not initiate concurrent cycle (concurrent cycle already in progress)");
1554     }
1555   }
1556 }
1557 
1558 class ParKnownGarbageHRClosure: public HeapRegionClosure {
1559   G1CollectedHeap* _g1h;
1560   CSetChooserParUpdater _cset_updater;
1561 
1562 public:
1563   ParKnownGarbageHRClosure(CollectionSetChooser* hrSorted,
1564                            uint chunk_size) :
1565     _g1h(G1CollectedHeap::heap()),
1566     _cset_updater(hrSorted, true /* parallel */, chunk_size) { }
1567 
1568   void doHeapRegion(HeapRegion* r) {
1569     // Do we have any marking information for this region?
1570     if (r->is_marked()) {
1571       // We will skip any region that's currently used as an old GC
1572       // alloc region (we should not consider those for collection
1573       // before we fill them up).
1574       if (_cset_updater.should_add(r) && !_g1h->is_old_gc_alloc_region(r)) {
1575         _cset_updater.add_region(r);
1576       }
1577     }

1578   }
1579 };
1580 
1581 class ParKnownGarbageTask: public AbstractGangTask {
1582   CollectionSetChooser* _hrSorted;
1583   uint _chunk_size;
1584   G1CollectedHeap* _g1;
1585   HeapRegionClaimer _hrclaimer;
1586 
1587 public:
1588   ParKnownGarbageTask(CollectionSetChooser* hrSorted, uint chunk_size, uint n_workers) :
1589       AbstractGangTask("ParKnownGarbageTask"),
1590       _hrSorted(hrSorted), _chunk_size(chunk_size),
1591       _g1(G1CollectedHeap::heap()), _hrclaimer(n_workers) {}
1592 
1593   void work(uint worker_id) {
1594     ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size);
1595     _g1->heap_region_par_iterate(&parKnownGarbageCl, worker_id, &_hrclaimer);
1596   }
1597 };


src/share/vm/gc/g1/g1CollectorPolicy.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File