< prev index next >

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

Print this page




1466       _g1h(g1h), _cm(_g1h->concurrent_mark()),
1467       _actual_region_bm(region_bm), _actual_card_bm(card_bm),
1468       _n_workers(_g1h->workers()->active_workers()), _hrclaimer(_n_workers) {
1469   }
1470 
1471   void work(uint worker_id) {
1472     assert(worker_id < _n_workers, "invariant");
1473 
1474     FinalCountDataUpdateClosure final_update_cl(_g1h,
1475                                                 _actual_region_bm,
1476                                                 _actual_card_bm);
1477 
1478     _g1h->heap_region_par_iterate(&final_update_cl, worker_id, &_hrclaimer);
1479   }
1480 };
1481 
1482 class G1NoteEndOfConcMarkClosure : public HeapRegionClosure {
1483   G1CollectedHeap* _g1;
1484   size_t _freed_bytes;
1485   FreeRegionList* _local_cleanup_list;
1486   HeapRegionSetCount _old_regions_removed;
1487   HeapRegionSetCount _humongous_regions_removed;
1488   HRRSCleanupTask* _hrrs_cleanup_task;
1489 
1490 public:
1491   G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1,
1492                              FreeRegionList* local_cleanup_list,
1493                              HRRSCleanupTask* hrrs_cleanup_task) :
1494     _g1(g1),
1495     _freed_bytes(0),
1496     _local_cleanup_list(local_cleanup_list),
1497     _old_regions_removed(),
1498     _humongous_regions_removed(),
1499     _hrrs_cleanup_task(hrrs_cleanup_task) { }
1500 
1501   size_t freed_bytes() { return _freed_bytes; }
1502   const HeapRegionSetCount& old_regions_removed() { return _old_regions_removed; }
1503   const HeapRegionSetCount& humongous_regions_removed() { return _humongous_regions_removed; }
1504 
1505   bool doHeapRegion(HeapRegion *hr) {
1506     if (hr->is_archive()) {
1507       return false;
1508     }
1509     // We use a claim value of zero here because all regions
1510     // were claimed with value 1 in the FinalCount task.
1511     _g1->reset_gc_time_stamps(hr);
1512     hr->note_end_of_marking();
1513 
1514     if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young()) {
1515       _freed_bytes += hr->used();
1516       hr->set_containing_set(NULL);
1517       if (hr->is_humongous()) {
1518         _humongous_regions_removed.increment(1u, hr->capacity());
1519         _g1->free_humongous_region(hr, _local_cleanup_list, true);
1520       } else {
1521         _old_regions_removed.increment(1u, hr->capacity());
1522         _g1->free_region(hr, _local_cleanup_list, true);
1523       }
1524     } else {
1525       hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task);
1526     }
1527 
1528     return false;
1529   }
1530 };
1531 
1532 class G1ParNoteEndTask: public AbstractGangTask {
1533   friend class G1NoteEndOfConcMarkClosure;
1534 
1535 protected:
1536   G1CollectedHeap* _g1h;
1537   FreeRegionList* _cleanup_list;
1538   HeapRegionClaimer _hrclaimer;
1539 
1540 public:
1541   G1ParNoteEndTask(G1CollectedHeap* g1h, FreeRegionList* cleanup_list, uint n_workers) :




1466       _g1h(g1h), _cm(_g1h->concurrent_mark()),
1467       _actual_region_bm(region_bm), _actual_card_bm(card_bm),
1468       _n_workers(_g1h->workers()->active_workers()), _hrclaimer(_n_workers) {
1469   }
1470 
1471   void work(uint worker_id) {
1472     assert(worker_id < _n_workers, "invariant");
1473 
1474     FinalCountDataUpdateClosure final_update_cl(_g1h,
1475                                                 _actual_region_bm,
1476                                                 _actual_card_bm);
1477 
1478     _g1h->heap_region_par_iterate(&final_update_cl, worker_id, &_hrclaimer);
1479   }
1480 };
1481 
1482 class G1NoteEndOfConcMarkClosure : public HeapRegionClosure {
1483   G1CollectedHeap* _g1;
1484   size_t _freed_bytes;
1485   FreeRegionList* _local_cleanup_list;
1486   uint _old_regions_removed;
1487   uint _humongous_regions_removed;
1488   HRRSCleanupTask* _hrrs_cleanup_task;
1489 
1490 public:
1491   G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1,
1492                              FreeRegionList* local_cleanup_list,
1493                              HRRSCleanupTask* hrrs_cleanup_task) :
1494     _g1(g1),
1495     _freed_bytes(0),
1496     _local_cleanup_list(local_cleanup_list),
1497     _old_regions_removed(0),
1498     _humongous_regions_removed(0),
1499     _hrrs_cleanup_task(hrrs_cleanup_task) { }
1500 
1501   size_t freed_bytes() { return _freed_bytes; }
1502   const uint old_regions_removed() { return _old_regions_removed; }
1503   const uint humongous_regions_removed() { return _humongous_regions_removed; }
1504 
1505   bool doHeapRegion(HeapRegion *hr) {
1506     if (hr->is_archive()) {
1507       return false;
1508     }
1509     // We use a claim value of zero here because all regions
1510     // were claimed with value 1 in the FinalCount task.
1511     _g1->reset_gc_time_stamps(hr);
1512     hr->note_end_of_marking();
1513 
1514     if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young()) {
1515       _freed_bytes += hr->used();
1516       hr->set_containing_set(NULL);
1517       if (hr->is_humongous()) {
1518         _humongous_regions_removed++;
1519         _g1->free_humongous_region(hr, _local_cleanup_list, true);
1520       } else {
1521         _old_regions_removed++;
1522         _g1->free_region(hr, _local_cleanup_list, true);
1523       }
1524     } else {
1525       hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task);
1526     }
1527 
1528     return false;
1529   }
1530 };
1531 
1532 class G1ParNoteEndTask: public AbstractGangTask {
1533   friend class G1NoteEndOfConcMarkClosure;
1534 
1535 protected:
1536   G1CollectedHeap* _g1h;
1537   FreeRegionList* _cleanup_list;
1538   HeapRegionClaimer _hrclaimer;
1539 
1540 public:
1541   G1ParNoteEndTask(G1CollectedHeap* g1h, FreeRegionList* cleanup_list, uint n_workers) :


< prev index next >