< prev index next >

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

Print this page




1506       _g1h(g1h), _cm(_g1h->concurrent_mark()),
1507       _actual_region_bm(region_bm), _actual_card_bm(card_bm),
1508       _n_workers(_g1h->workers()->active_workers()), _hrclaimer(_n_workers) {
1509   }
1510 
1511   void work(uint worker_id) {
1512     assert(worker_id < _n_workers, "invariant");
1513 
1514     FinalCountDataUpdateClosure final_update_cl(_g1h,
1515                                                 _actual_region_bm,
1516                                                 _actual_card_bm);
1517 
1518     _g1h->heap_region_par_iterate(&final_update_cl, worker_id, &_hrclaimer);
1519   }
1520 };
1521 
1522 class G1NoteEndOfConcMarkClosure : public HeapRegionClosure {
1523   G1CollectedHeap* _g1;
1524   size_t _freed_bytes;
1525   FreeRegionList* _local_cleanup_list;
1526   HeapRegionSetCount _old_regions_removed;
1527   HeapRegionSetCount _humongous_regions_removed;
1528   HRRSCleanupTask* _hrrs_cleanup_task;
1529 
1530 public:
1531   G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1,
1532                              FreeRegionList* local_cleanup_list,
1533                              HRRSCleanupTask* hrrs_cleanup_task) :
1534     _g1(g1),
1535     _freed_bytes(0),
1536     _local_cleanup_list(local_cleanup_list),
1537     _old_regions_removed(),
1538     _humongous_regions_removed(),
1539     _hrrs_cleanup_task(hrrs_cleanup_task) { }
1540 
1541   size_t freed_bytes() { return _freed_bytes; }
1542   const HeapRegionSetCount& old_regions_removed() { return _old_regions_removed; }
1543   const HeapRegionSetCount& humongous_regions_removed() { return _humongous_regions_removed; }
1544 
1545   bool doHeapRegion(HeapRegion *hr) {
1546     if (hr->is_archive()) {
1547       return false;
1548     }
1549     // We use a claim value of zero here because all regions
1550     // were claimed with value 1 in the FinalCount task.
1551     _g1->reset_gc_time_stamps(hr);
1552     hr->note_end_of_marking();
1553 
1554     if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young()) {
1555       _freed_bytes += hr->used();
1556       hr->set_containing_set(NULL);
1557       if (hr->is_humongous()) {
1558         _humongous_regions_removed.increment(1u, hr->capacity());
1559         _g1->free_humongous_region(hr, _local_cleanup_list, true);
1560       } else {
1561         _old_regions_removed.increment(1u, hr->capacity());
1562         _g1->free_region(hr, _local_cleanup_list, true);
1563       }
1564     } else {
1565       hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task);
1566     }
1567 
1568     return false;
1569   }
1570 };
1571 
1572 class G1ParNoteEndTask: public AbstractGangTask {
1573   friend class G1NoteEndOfConcMarkClosure;
1574 
1575 protected:
1576   G1CollectedHeap* _g1h;
1577   FreeRegionList* _cleanup_list;
1578   HeapRegionClaimer _hrclaimer;
1579 
1580 public:
1581   G1ParNoteEndTask(G1CollectedHeap* g1h, FreeRegionList* cleanup_list, uint n_workers) :




1506       _g1h(g1h), _cm(_g1h->concurrent_mark()),
1507       _actual_region_bm(region_bm), _actual_card_bm(card_bm),
1508       _n_workers(_g1h->workers()->active_workers()), _hrclaimer(_n_workers) {
1509   }
1510 
1511   void work(uint worker_id) {
1512     assert(worker_id < _n_workers, "invariant");
1513 
1514     FinalCountDataUpdateClosure final_update_cl(_g1h,
1515                                                 _actual_region_bm,
1516                                                 _actual_card_bm);
1517 
1518     _g1h->heap_region_par_iterate(&final_update_cl, worker_id, &_hrclaimer);
1519   }
1520 };
1521 
1522 class G1NoteEndOfConcMarkClosure : public HeapRegionClosure {
1523   G1CollectedHeap* _g1;
1524   size_t _freed_bytes;
1525   FreeRegionList* _local_cleanup_list;
1526   uint _old_regions_removed;
1527   uint _humongous_regions_removed;
1528   HRRSCleanupTask* _hrrs_cleanup_task;
1529 
1530 public:
1531   G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1,
1532                              FreeRegionList* local_cleanup_list,
1533                              HRRSCleanupTask* hrrs_cleanup_task) :
1534     _g1(g1),
1535     _freed_bytes(0),
1536     _local_cleanup_list(local_cleanup_list),
1537     _old_regions_removed(0),
1538     _humongous_regions_removed(0),
1539     _hrrs_cleanup_task(hrrs_cleanup_task) { }
1540 
1541   size_t freed_bytes() { return _freed_bytes; }
1542   const uint old_regions_removed() { return _old_regions_removed; }
1543   const uint humongous_regions_removed() { return _humongous_regions_removed; }
1544 
1545   bool doHeapRegion(HeapRegion *hr) {
1546     if (hr->is_archive()) {
1547       return false;
1548     }
1549     // We use a claim value of zero here because all regions
1550     // were claimed with value 1 in the FinalCount task.
1551     _g1->reset_gc_time_stamps(hr);
1552     hr->note_end_of_marking();
1553 
1554     if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young()) {
1555       _freed_bytes += hr->used();
1556       hr->set_containing_set(NULL);
1557       if (hr->is_humongous()) {
1558         _humongous_regions_removed++;
1559         _g1->free_humongous_region(hr, _local_cleanup_list, true);
1560       } else {
1561         _old_regions_removed++;
1562         _g1->free_region(hr, _local_cleanup_list, true);
1563       }
1564     } else {
1565       hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task);
1566     }
1567 
1568     return false;
1569   }
1570 };
1571 
1572 class G1ParNoteEndTask: public AbstractGangTask {
1573   friend class G1NoteEndOfConcMarkClosure;
1574 
1575 protected:
1576   G1CollectedHeap* _g1h;
1577   FreeRegionList* _cleanup_list;
1578   HeapRegionClaimer _hrclaimer;
1579 
1580 public:
1581   G1ParNoteEndTask(G1CollectedHeap* g1h, FreeRegionList* cleanup_list, uint n_workers) :


< prev index next >