1736 verify_region_sets_optional();
1737
1738 // We should only reach here at the end of a Full GC which means we
1739 // should not not be holding to any GC alloc regions. The method
1740 // below will make sure of that and do any remaining clean up.
1741 _allocator->abandon_gc_alloc_regions();
1742
1743 // Instead of tearing down / rebuilding the free lists here, we
1744 // could instead use the remove_all_pending() method on free_list to
1745 // remove only the ones that we need to remove.
1746 tear_down_region_sets(true /* free_list_only */);
1747 shrink_helper(shrink_bytes);
1748 rebuild_region_sets(true /* free_list_only */);
1749
1750 _hrm.verify_optional();
1751 verify_region_sets_optional();
1752 }
1753
1754 // Public methods.
1755
1756 #ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away
1757 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
1758 #endif // _MSC_VER
1759
1760
1761 G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
1762 SharedHeap(policy_),
1763 _g1_policy(policy_),
1764 _dirty_card_queue_set(false),
1765 _into_cset_dirty_card_queue_set(false),
1766 _is_alive_closure_cm(this),
1767 _is_alive_closure_stw(this),
1768 _ref_processor_cm(NULL),
1769 _ref_processor_stw(NULL),
1770 _process_strong_tasks(new SubTasksDone(G1H_PS_NumElements)),
1771 _bot_shared(NULL),
1772 _evac_failure_scan_stack(NULL),
1773 _mark_in_progress(false),
1774 _cg1r(NULL),
1775 _g1mm(NULL),
1776 _refine_cte_cl(NULL),
1777 _full_collection(false),
1778 _secondary_free_list("Secondary Free List", new SecondaryFreeRegionListMtSafeChecker()),
1779 _old_set("Old Set", false /* humongous */, new OldRegionSetMtSafeChecker()),
1780 _humongous_set("Master Humongous Set", true /* humongous */, new HumongousRegionSetMtSafeChecker()),
1781 _humongous_is_live(),
1782 _has_humongous_reclaim_candidates(false),
1783 _free_regions_coming(false),
1784 _young_list(new YoungList(this)),
1785 _gc_time_stamp(0),
1786 _survivor_plab_stats(YoungPLABSize, PLABWeight),
1787 _old_plab_stats(OldPLABSize, PLABWeight),
1788 _expand_heap_after_alloc_failure(true),
1789 _surviving_young_words(NULL),
1790 _old_marking_cycles_started(0),
1791 _old_marking_cycles_completed(0),
1792 _concurrent_cycle_started(false),
1793 _heap_summary_sent(false),
1794 _in_cset_fast_test(),
1795 _dirty_cards_region_list(NULL),
1796 _worker_cset_start_region(NULL),
1797 _worker_cset_start_region_time_stamp(NULL),
1798 _gc_timer_stw(new (ResourceObj::C_HEAP, mtGC) STWGCTimer()),
1799 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
1800 _gc_tracer_stw(new (ResourceObj::C_HEAP, mtGC) G1NewTracer()),
1801 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
1802
1803 _g1h = this;
1804 if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) {
1805 vm_exit_during_initialization("Failed necessary allocation.");
1806 }
1807
1808 _allocator = G1Allocator::create_allocator(_g1h);
1809 _humongous_object_threshold_in_words = HeapRegion::GrainWords / 2;
1810
1811 int n_queues = MAX2((int)ParallelGCThreads, 1);
1812 _task_queues = new RefToScanQueueSet(n_queues);
1813
1814 uint n_rem_sets = HeapRegionRemSet::num_par_rem_sets();
1815 assert(n_rem_sets > 0, "Invariant.");
1816
1817 _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
1818 _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues, mtGC);
1819 _evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC);
1820
1821 for (int i = 0; i < n_queues; i++) {
1822 RefToScanQueue* q = new RefToScanQueue();
1823 q->initialize();
|
1736 verify_region_sets_optional();
1737
1738 // We should only reach here at the end of a Full GC which means we
1739 // should not not be holding to any GC alloc regions. The method
1740 // below will make sure of that and do any remaining clean up.
1741 _allocator->abandon_gc_alloc_regions();
1742
1743 // Instead of tearing down / rebuilding the free lists here, we
1744 // could instead use the remove_all_pending() method on free_list to
1745 // remove only the ones that we need to remove.
1746 tear_down_region_sets(true /* free_list_only */);
1747 shrink_helper(shrink_bytes);
1748 rebuild_region_sets(true /* free_list_only */);
1749
1750 _hrm.verify_optional();
1751 verify_region_sets_optional();
1752 }
1753
1754 // Public methods.
1755
1756 G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
1757 SharedHeap(policy_),
1758 _g1_policy(policy_),
1759 _dirty_card_queue_set(false),
1760 _into_cset_dirty_card_queue_set(false),
1761 _ref_processor_cm(NULL),
1762 _ref_processor_stw(NULL),
1763 _process_strong_tasks(new SubTasksDone(G1H_PS_NumElements)),
1764 _bot_shared(NULL),
1765 _evac_failure_scan_stack(NULL),
1766 _mark_in_progress(false),
1767 _cg1r(NULL),
1768 _g1mm(NULL),
1769 _refine_cte_cl(NULL),
1770 _full_collection(false),
1771 _secondary_free_list("Secondary Free List", new SecondaryFreeRegionListMtSafeChecker()),
1772 _old_set("Old Set", false /* humongous */, new OldRegionSetMtSafeChecker()),
1773 _humongous_set("Master Humongous Set", true /* humongous */, new HumongousRegionSetMtSafeChecker()),
1774 _humongous_is_live(),
1775 _has_humongous_reclaim_candidates(false),
1776 _free_regions_coming(false),
1777 _gc_time_stamp(0),
1778 _survivor_plab_stats(YoungPLABSize, PLABWeight),
1779 _old_plab_stats(OldPLABSize, PLABWeight),
1780 _expand_heap_after_alloc_failure(true),
1781 _surviving_young_words(NULL),
1782 _old_marking_cycles_started(0),
1783 _old_marking_cycles_completed(0),
1784 _concurrent_cycle_started(false),
1785 _heap_summary_sent(false),
1786 _in_cset_fast_test(),
1787 _dirty_cards_region_list(NULL),
1788 _worker_cset_start_region(NULL),
1789 _worker_cset_start_region_time_stamp(NULL),
1790 _gc_timer_stw(new (ResourceObj::C_HEAP, mtGC) STWGCTimer()),
1791 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
1792 _gc_tracer_stw(new (ResourceObj::C_HEAP, mtGC) G1NewTracer()),
1793 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
1794
1795 _is_alive_closure_cm = G1CMIsAliveClosure(this);
1796 _is_alive_closure_stw = G1STWIsAliveClosure(this);
1797 _young_list = new YoungList(this);
1798 _g1h = this;
1799
1800 if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) {
1801 vm_exit_during_initialization("Failed necessary allocation.");
1802 }
1803
1804 _allocator = G1Allocator::create_allocator(_g1h);
1805 _humongous_object_threshold_in_words = HeapRegion::GrainWords / 2;
1806
1807 int n_queues = MAX2((int)ParallelGCThreads, 1);
1808 _task_queues = new RefToScanQueueSet(n_queues);
1809
1810 uint n_rem_sets = HeapRegionRemSet::num_par_rem_sets();
1811 assert(n_rem_sets > 0, "Invariant.");
1812
1813 _worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
1814 _worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues, mtGC);
1815 _evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC);
1816
1817 for (int i = 0; i < n_queues; i++) {
1818 RefToScanQueue* q = new RefToScanQueue();
1819 q->initialize();
|