1643 heap_alignment);
1644
1645 initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
1646
1647 // Create the barrier set for the entire reserved region.
1648 G1CardTable* ct = new G1CardTable(reserved_region());
1649 ct->initialize();
1650 G1BarrierSet* bs = new G1BarrierSet(ct);
1651 bs->initialize();
1652 assert(bs->is_a(BarrierSet::G1BarrierSet), "sanity");
1653 BarrierSet::set_barrier_set(bs);
1654 _card_table = ct;
1655
1656 G1BarrierSet::satb_mark_queue_set().initialize(this,
1657 SATB_Q_CBL_mon,
1658 &bs->satb_mark_queue_buffer_allocator(),
1659 G1SATBProcessCompletedThreshold,
1660 G1SATBBufferEnqueueingThresholdPercent,
1661 Shared_SATB_Q_lock);
1662
1663 // process_completed_threshold and max_completed_queue are updated
1664 // later, based on the concurrent refinement object.
1665 G1BarrierSet::dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
1666 &bs->dirty_card_queue_buffer_allocator(),
1667 -1, // temp. never trigger
1668 -1, // temp. no limit
1669 Shared_DirtyCardQ_lock,
1670 true); // init_free_ids
1671
1672 dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
1673 &bs->dirty_card_queue_buffer_allocator(),
1674 -1, // never trigger processing
1675 -1, // no limit on length
1676 Shared_DirtyCardQ_lock);
1677
1678 // Create the hot card cache.
1679 _hot_card_cache = new G1HotCardCache(this);
1680
1681 // Carve out the G1 part of the heap.
1682 ReservedSpace g1_rs = heap_rs.first_part(max_byte_size);
1683 size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
1684 G1RegionToSpaceMapper* heap_storage =
1685 G1RegionToSpaceMapper::create_mapper(g1_rs,
1686 g1_rs.size(),
1687 page_size,
1688 HeapRegion::GrainBytes,
1689 1,
1690 mtJavaHeap);
1691 os::trace_page_sizes("Heap",
1692 collector_policy()->min_heap_byte_size(),
1693 max_byte_size,
1694 page_size,
1695 heap_rs.base(),
1766 if (!expand(init_byte_size, _workers)) {
1767 vm_shutdown_during_initialization("Failed to allocate initial heap.");
1768 return JNI_ENOMEM;
1769 }
1770
1771 // Perform any initialization actions delegated to the policy.
1772 g1_policy()->init(this, &_collection_set);
1773
1774 jint ecode = initialize_concurrent_refinement();
1775 if (ecode != JNI_OK) {
1776 return ecode;
1777 }
1778
1779 ecode = initialize_young_gen_sampling_thread();
1780 if (ecode != JNI_OK) {
1781 return ecode;
1782 }
1783
1784 {
1785 DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
1786 dcqs.set_process_completed_threshold((int)concurrent_refine()->yellow_zone());
1787 dcqs.set_max_completed_queue((int)concurrent_refine()->red_zone());
1788 }
1789
1790 // Here we allocate the dummy HeapRegion that is required by the
1791 // G1AllocRegion class.
1792 HeapRegion* dummy_region = _hrm.get_dummy_region();
1793
1794 // We'll re-use the same region whether the alloc region will
1795 // require BOT updates or not and, if it doesn't, then a non-young
1796 // region will complain that it cannot support allocations without
1797 // BOT updates. So we'll tag the dummy region as eden to avoid that.
1798 dummy_region->set_eden();
1799 // Make sure it's full.
1800 dummy_region->set_top(dummy_region->end());
1801 G1AllocRegion::setup(this, dummy_region);
1802
1803 _allocator->init_mutator_alloc_region();
1804
1805 // Do create of the monitoring and management support so that
1806 // values in the heap have been properly initialized.
1807 _g1mm = new G1MonitoringSupport(this);
|
1643 heap_alignment);
1644
1645 initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
1646
1647 // Create the barrier set for the entire reserved region.
1648 G1CardTable* ct = new G1CardTable(reserved_region());
1649 ct->initialize();
1650 G1BarrierSet* bs = new G1BarrierSet(ct);
1651 bs->initialize();
1652 assert(bs->is_a(BarrierSet::G1BarrierSet), "sanity");
1653 BarrierSet::set_barrier_set(bs);
1654 _card_table = ct;
1655
1656 G1BarrierSet::satb_mark_queue_set().initialize(this,
1657 SATB_Q_CBL_mon,
1658 &bs->satb_mark_queue_buffer_allocator(),
1659 G1SATBProcessCompletedThreshold,
1660 G1SATBBufferEnqueueingThresholdPercent,
1661 Shared_SATB_Q_lock);
1662
1663
1664 // process_completed_buffers_threshold and max_completed_buffers are updated
1665 // later, based on the concurrent refinement object.
1666 G1BarrierSet::dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
1667 &bs->dirty_card_queue_buffer_allocator(),
1668 Shared_DirtyCardQ_lock,
1669 true); // init_free_ids
1670
1671 dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
1672 &bs->dirty_card_queue_buffer_allocator(),
1673 Shared_DirtyCardQ_lock);
1674
1675 // Create the hot card cache.
1676 _hot_card_cache = new G1HotCardCache(this);
1677
1678 // Carve out the G1 part of the heap.
1679 ReservedSpace g1_rs = heap_rs.first_part(max_byte_size);
1680 size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
1681 G1RegionToSpaceMapper* heap_storage =
1682 G1RegionToSpaceMapper::create_mapper(g1_rs,
1683 g1_rs.size(),
1684 page_size,
1685 HeapRegion::GrainBytes,
1686 1,
1687 mtJavaHeap);
1688 os::trace_page_sizes("Heap",
1689 collector_policy()->min_heap_byte_size(),
1690 max_byte_size,
1691 page_size,
1692 heap_rs.base(),
1763 if (!expand(init_byte_size, _workers)) {
1764 vm_shutdown_during_initialization("Failed to allocate initial heap.");
1765 return JNI_ENOMEM;
1766 }
1767
1768 // Perform any initialization actions delegated to the policy.
1769 g1_policy()->init(this, &_collection_set);
1770
1771 jint ecode = initialize_concurrent_refinement();
1772 if (ecode != JNI_OK) {
1773 return ecode;
1774 }
1775
1776 ecode = initialize_young_gen_sampling_thread();
1777 if (ecode != JNI_OK) {
1778 return ecode;
1779 }
1780
1781 {
1782 DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
1783 dcqs.set_process_completed_buffers_threshold(concurrent_refine()->yellow_zone());
1784 dcqs.set_max_completed_buffers(concurrent_refine()->red_zone());
1785 }
1786
1787 // Here we allocate the dummy HeapRegion that is required by the
1788 // G1AllocRegion class.
1789 HeapRegion* dummy_region = _hrm.get_dummy_region();
1790
1791 // We'll re-use the same region whether the alloc region will
1792 // require BOT updates or not and, if it doesn't, then a non-young
1793 // region will complain that it cannot support allocations without
1794 // BOT updates. So we'll tag the dummy region as eden to avoid that.
1795 dummy_region->set_eden();
1796 // Make sure it's full.
1797 dummy_region->set_top(dummy_region->end());
1798 G1AllocRegion::setup(this, dummy_region);
1799
1800 _allocator->init_mutator_alloc_region();
1801
1802 // Do create of the monitoring and management support so that
1803 // values in the heap have been properly initialized.
1804 _g1mm = new G1MonitoringSupport(this);
|