1510 G1CollectedHeap* _g1; |
1510 G1CollectedHeap* _g1; |
1511 int _worker_num; |
1511 int _worker_num; |
1512 size_t _max_live_bytes; |
1512 size_t _max_live_bytes; |
1513 size_t _regions_claimed; |
1513 size_t _regions_claimed; |
1514 size_t _freed_bytes; |
1514 size_t _freed_bytes; |
1515 FreeRegionList _local_cleanup_list; |
1515 FreeRegionList* _local_cleanup_list; |
1516 HumongousRegionSet _humongous_proxy_set; |
1516 HumongousRegionSet* _humongous_proxy_set; |
|
1517 HRRSCleanupTask* _hrrs_cleanup_task; |
1517 double _claimed_region_time; |
1518 double _claimed_region_time; |
1518 double _max_region_time; |
1519 double _max_region_time; |
1519 |
1520 |
1520 public: |
1521 public: |
1521 G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, |
1522 G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, |
1522 int worker_num); |
1523 int worker_num, |
|
1524 FreeRegionList* local_cleanup_list, |
|
1525 HumongousRegionSet* humongous_proxy_set, |
|
1526 HRRSCleanupTask* hrrs_cleanup_task); |
1523 size_t freed_bytes() { return _freed_bytes; } |
1527 size_t freed_bytes() { return _freed_bytes; } |
1524 FreeRegionList* local_cleanup_list() { |
|
1525 return &_local_cleanup_list; |
|
1526 } |
|
1527 HumongousRegionSet* humongous_proxy_set() { |
|
1528 return &_humongous_proxy_set; |
|
1529 } |
|
1530 |
1528 |
1531 bool doHeapRegion(HeapRegion *r); |
1529 bool doHeapRegion(HeapRegion *r); |
1532 |
1530 |
1533 size_t max_live_bytes() { return _max_live_bytes; } |
1531 size_t max_live_bytes() { return _max_live_bytes; } |
1534 size_t regions_claimed() { return _regions_claimed; } |
1532 size_t regions_claimed() { return _regions_claimed; } |
1551 AbstractGangTask("G1 note end"), _g1h(g1h), |
1549 AbstractGangTask("G1 note end"), _g1h(g1h), |
1552 _max_live_bytes(0), _freed_bytes(0), _cleanup_list(cleanup_list) { } |
1550 _max_live_bytes(0), _freed_bytes(0), _cleanup_list(cleanup_list) { } |
1553 |
1551 |
1554 void work(int i) { |
1552 void work(int i) { |
1555 double start = os::elapsedTime(); |
1553 double start = os::elapsedTime(); |
1556 G1NoteEndOfConcMarkClosure g1_note_end(_g1h, i); |
1554 FreeRegionList local_cleanup_list("Local Cleanup List"); |
|
1555 HumongousRegionSet humongous_proxy_set("Local Cleanup Humongous Proxy Set"); |
|
1556 HRRSCleanupTask hrrs_cleanup_task; |
|
1557 G1NoteEndOfConcMarkClosure g1_note_end(_g1h, i, &local_cleanup_list, |
|
1558 &humongous_proxy_set, |
|
1559 &hrrs_cleanup_task); |
1557 if (G1CollectedHeap::use_parallel_gc_threads()) { |
1560 if (G1CollectedHeap::use_parallel_gc_threads()) { |
1558 _g1h->heap_region_par_iterate_chunked(&g1_note_end, i, |
1561 _g1h->heap_region_par_iterate_chunked(&g1_note_end, i, |
1559 HeapRegion::NoteEndClaimValue); |
1562 HeapRegion::NoteEndClaimValue); |
1560 } else { |
1563 } else { |
1561 _g1h->heap_region_iterate(&g1_note_end); |
1564 _g1h->heap_region_iterate(&g1_note_end); |
1563 assert(g1_note_end.complete(), "Shouldn't have yielded!"); |
1566 assert(g1_note_end.complete(), "Shouldn't have yielded!"); |
1564 |
1567 |
1565 // Now update the lists |
1568 // Now update the lists |
1566 _g1h->update_sets_after_freeing_regions(g1_note_end.freed_bytes(), |
1569 _g1h->update_sets_after_freeing_regions(g1_note_end.freed_bytes(), |
1567 NULL /* free_list */, |
1570 NULL /* free_list */, |
1568 g1_note_end.humongous_proxy_set(), |
1571 &humongous_proxy_set, |
1569 true /* par */); |
1572 true /* par */); |
1570 { |
1573 { |
1571 MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); |
1574 MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); |
1572 _max_live_bytes += g1_note_end.max_live_bytes(); |
1575 _max_live_bytes += g1_note_end.max_live_bytes(); |
1573 _freed_bytes += g1_note_end.freed_bytes(); |
1576 _freed_bytes += g1_note_end.freed_bytes(); |
1574 |
1577 |
1575 _cleanup_list->add_as_tail(g1_note_end.local_cleanup_list()); |
1578 _cleanup_list->add_as_tail(&local_cleanup_list); |
1576 assert(g1_note_end.local_cleanup_list()->is_empty(), "post-condition"); |
1579 assert(local_cleanup_list.is_empty(), "post-condition"); |
|
1580 |
|
1581 HeapRegionRemSet::finish_cleanup_task(&hrrs_cleanup_task); |
1577 } |
1582 } |
1578 double end = os::elapsedTime(); |
1583 double end = os::elapsedTime(); |
1579 if (G1PrintParCleanupStats) { |
1584 if (G1PrintParCleanupStats) { |
1580 gclog_or_tty->print(" Worker thread %d [%8.3f..%8.3f = %8.3f ms] " |
1585 gclog_or_tty->print(" Worker thread %d [%8.3f..%8.3f = %8.3f ms] " |
1581 "claimed %d regions (tot = %8.3f ms, max = %8.3f ms).\n", |
1586 "claimed %d regions (tot = %8.3f ms, max = %8.3f ms).\n", |
1612 |
1617 |
1613 }; |
1618 }; |
1614 |
1619 |
1615 G1NoteEndOfConcMarkClosure:: |
1620 G1NoteEndOfConcMarkClosure:: |
1616 G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, |
1621 G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, |
1617 int worker_num) |
1622 int worker_num, |
|
1623 FreeRegionList* local_cleanup_list, |
|
1624 HumongousRegionSet* humongous_proxy_set, |
|
1625 HRRSCleanupTask* hrrs_cleanup_task) |
1618 : _g1(g1), _worker_num(worker_num), |
1626 : _g1(g1), _worker_num(worker_num), |
1619 _max_live_bytes(0), _regions_claimed(0), |
1627 _max_live_bytes(0), _regions_claimed(0), |
1620 _freed_bytes(0), |
1628 _freed_bytes(0), |
1621 _claimed_region_time(0.0), _max_region_time(0.0), |
1629 _claimed_region_time(0.0), _max_region_time(0.0), |
1622 _local_cleanup_list("Local Cleanup List"), |
1630 _local_cleanup_list(local_cleanup_list), |
1623 _humongous_proxy_set("Local Cleanup Humongous Proxy Set") { } |
1631 _humongous_proxy_set(humongous_proxy_set), |
|
1632 _hrrs_cleanup_task(hrrs_cleanup_task) { } |
1624 |
1633 |
1625 bool G1NoteEndOfConcMarkClosure::doHeapRegion(HeapRegion *hr) { |
1634 bool G1NoteEndOfConcMarkClosure::doHeapRegion(HeapRegion *hr) { |
1626 // We use a claim value of zero here because all regions |
1635 // We use a claim value of zero here because all regions |
1627 // were claimed with value 1 in the FinalCount task. |
1636 // were claimed with value 1 in the FinalCount task. |
1628 hr->reset_gc_time_stamp(); |
1637 hr->reset_gc_time_stamp(); |
1629 if (!hr->continuesHumongous()) { |
1638 if (!hr->continuesHumongous()) { |
1630 double start = os::elapsedTime(); |
1639 double start = os::elapsedTime(); |
1631 _regions_claimed++; |
1640 _regions_claimed++; |
1632 hr->note_end_of_marking(); |
1641 hr->note_end_of_marking(); |
1633 _max_live_bytes += hr->max_live_bytes(); |
1642 _max_live_bytes += hr->max_live_bytes(); |
1634 _g1->free_region_if_totally_empty(hr, |
1643 _g1->free_region_if_empty(hr, |
1635 &_freed_bytes, |
1644 &_freed_bytes, |
1636 &_local_cleanup_list, |
1645 _local_cleanup_list, |
1637 &_humongous_proxy_set, |
1646 _humongous_proxy_set, |
1638 true /* par */); |
1647 _hrrs_cleanup_task, |
|
1648 true /* par */); |
1639 double region_time = (os::elapsedTime() - start); |
1649 double region_time = (os::elapsedTime() - start); |
1640 _claimed_region_time += region_time; |
1650 _claimed_region_time += region_time; |
1641 if (region_time > _max_region_time) _max_region_time = region_time; |
1651 if (region_time > _max_region_time) _max_region_time = region_time; |
1642 } |
1652 } |
1643 return false; |
1653 return false; |
1668 |
1678 |
1669 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); |
1679 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); |
1670 g1p->record_concurrent_mark_cleanup_start(); |
1680 g1p->record_concurrent_mark_cleanup_start(); |
1671 |
1681 |
1672 double start = os::elapsedTime(); |
1682 double start = os::elapsedTime(); |
|
1683 |
|
1684 HeapRegionRemSet::reset_for_cleanup_tasks(); |
1673 |
1685 |
1674 // Do counting once more with the world stopped for good measure. |
1686 // Do counting once more with the world stopped for good measure. |
1675 G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), |
1687 G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), |
1676 &_region_bm, &_card_bm); |
1688 &_region_bm, &_card_bm); |
1677 if (G1CollectedHeap::use_parallel_gc_threads()) { |
1689 if (G1CollectedHeap::use_parallel_gc_threads()) { |