< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page
rev 60594 : [mq]: 8252086-remove-g1rs


1601   initialize_reserved_region(heap_rs);
1602 
1603   // Create the barrier set for the entire reserved region.
1604   G1CardTable* ct = new G1CardTable(heap_rs.region());
1605   ct->initialize();
1606   G1BarrierSet* bs = new G1BarrierSet(ct);
1607   bs->initialize();
1608   assert(bs->is_a(BarrierSet::G1BarrierSet), "sanity");
1609   BarrierSet::set_barrier_set(bs);
1610   _card_table = ct;
1611 
1612   {
1613     G1SATBMarkQueueSet& satbqs = bs->satb_mark_queue_set();
1614     satbqs.set_process_completed_buffers_threshold(G1SATBProcessCompletedThreshold);
1615     satbqs.set_buffer_enqueue_threshold_percentage(G1SATBBufferEnqueueingThresholdPercent);
1616   }
1617 
1618   // Create the hot card cache.
1619   _hot_card_cache = new G1HotCardCache(this);
1620 
1621   // Carve out the G1 part of the heap.
1622   ReservedSpace g1_rs = heap_rs.first_part(reserved_byte_size);
1623   size_t page_size = actual_reserved_page_size(heap_rs);
1624   G1RegionToSpaceMapper* heap_storage =
1625     G1RegionToSpaceMapper::create_heap_mapper(g1_rs,
1626                                               g1_rs.size(),
1627                                               page_size,
1628                                               HeapRegion::GrainBytes,
1629                                               1,
1630                                               mtJavaHeap);
1631   if(heap_storage == NULL) {
1632     vm_shutdown_during_initialization("Could not initialize G1 heap");
1633     return JNI_ERR;
1634   }
1635 
1636   os::trace_page_sizes("Heap",
1637                        MinHeapSize,
1638                        reserved_byte_size,
1639                        page_size,
1640                        heap_rs.base(),
1641                        heap_rs.size());
1642   heap_storage->set_mapping_changed_listener(&_listener);
1643 
1644   // Create storage for the BOT, card table, card counts table (hot card cache) and the bitmaps.
1645   G1RegionToSpaceMapper* bot_storage =
1646     create_aux_memory_mapper("Block Offset Table",
1647                              G1BlockOffsetTable::compute_size(g1_rs.size() / HeapWordSize),
1648                              G1BlockOffsetTable::heap_map_factor());
1649 
1650   G1RegionToSpaceMapper* cardtable_storage =
1651     create_aux_memory_mapper("Card Table",
1652                              G1CardTable::compute_size(g1_rs.size() / HeapWordSize),
1653                              G1CardTable::heap_map_factor());
1654 
1655   G1RegionToSpaceMapper* card_counts_storage =
1656     create_aux_memory_mapper("Card Counts Table",
1657                              G1CardCounts::compute_size(g1_rs.size() / HeapWordSize),
1658                              G1CardCounts::heap_map_factor());
1659 
1660   size_t bitmap_size = G1CMBitMap::compute_size(g1_rs.size());
1661   G1RegionToSpaceMapper* prev_bitmap_storage =
1662     create_aux_memory_mapper("Prev Bitmap", bitmap_size, G1CMBitMap::heap_map_factor());
1663   G1RegionToSpaceMapper* next_bitmap_storage =
1664     create_aux_memory_mapper("Next Bitmap", bitmap_size, G1CMBitMap::heap_map_factor());
1665 
1666   _hrm = HeapRegionManager::create_manager(this);
1667 
1668   _hrm->initialize(heap_storage, prev_bitmap_storage, next_bitmap_storage, bot_storage, cardtable_storage, card_counts_storage);
1669   _card_table->initialize(cardtable_storage);
1670 
1671   // Do later initialization work for concurrent refinement.
1672   _hot_card_cache->initialize(card_counts_storage);
1673 
1674   // 6843694 - ensure that the maximum region index can fit
1675   // in the remembered set structures.
1676   const uint max_region_idx = (1U << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1;
1677   guarantee((max_regions() - 1) <= max_region_idx, "too many regions");
1678 
1679   // The G1FromCardCache reserves card with value 0 as "invalid", so the heap must not
1680   // start within the first card.
1681   guarantee(g1_rs.base() >= (char*)G1CardTable::card_size, "Java heap must not start within the first card.");
1682   // Also create a G1 rem set.
1683   _rem_set = new G1RemSet(this, _card_table, _hot_card_cache);
1684   _rem_set->initialize(max_regions());
1685 
1686   size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1;
1687   guarantee(HeapRegion::CardsPerRegion > 0, "make sure it's initialized");
1688   guarantee(HeapRegion::CardsPerRegion < max_cards_per_region,
1689             "too many cards per region");
1690 
1691   FreeRegionList::set_unrealistically_long_length(max_expandable_regions() + 1);
1692 
1693   _bot = new G1BlockOffsetTable(reserved(), bot_storage);
1694 
1695   {
1696     size_t granularity = HeapRegion::GrainBytes;
1697 
1698     _region_attr.initialize(reserved(), granularity);
1699     _humongous_reclaim_candidates.initialize(reserved(), granularity);
1700   }
1701 




1601   initialize_reserved_region(heap_rs);
1602 
1603   // Create the barrier set for the entire reserved region.
1604   G1CardTable* ct = new G1CardTable(heap_rs.region());
1605   ct->initialize();
1606   G1BarrierSet* bs = new G1BarrierSet(ct);
1607   bs->initialize();
1608   assert(bs->is_a(BarrierSet::G1BarrierSet), "sanity");
1609   BarrierSet::set_barrier_set(bs);
1610   _card_table = ct;
1611 
1612   {
1613     G1SATBMarkQueueSet& satbqs = bs->satb_mark_queue_set();
1614     satbqs.set_process_completed_buffers_threshold(G1SATBProcessCompletedThreshold);
1615     satbqs.set_buffer_enqueue_threshold_percentage(G1SATBBufferEnqueueingThresholdPercent);
1616   }
1617 
1618   // Create the hot card cache.
1619   _hot_card_cache = new G1HotCardCache(this);
1620 
1621   // Create space mappers.

1622   size_t page_size = actual_reserved_page_size(heap_rs);
1623   G1RegionToSpaceMapper* heap_storage =
1624     G1RegionToSpaceMapper::create_heap_mapper(heap_rs,
1625                                               heap_rs.size(),
1626                                               page_size,
1627                                               HeapRegion::GrainBytes,
1628                                               1,
1629                                               mtJavaHeap);
1630   if(heap_storage == NULL) {
1631     vm_shutdown_during_initialization("Could not initialize G1 heap");
1632     return JNI_ERR;
1633   }
1634 
1635   os::trace_page_sizes("Heap",
1636                        MinHeapSize,
1637                        reserved_byte_size,
1638                        page_size,
1639                        heap_rs.base(),
1640                        heap_rs.size());
1641   heap_storage->set_mapping_changed_listener(&_listener);
1642 
1643   // Create storage for the BOT, card table, card counts table (hot card cache) and the bitmaps.
1644   G1RegionToSpaceMapper* bot_storage =
1645     create_aux_memory_mapper("Block Offset Table",
1646                              G1BlockOffsetTable::compute_size(heap_rs.size() / HeapWordSize),
1647                              G1BlockOffsetTable::heap_map_factor());
1648 
1649   G1RegionToSpaceMapper* cardtable_storage =
1650     create_aux_memory_mapper("Card Table",
1651                              G1CardTable::compute_size(heap_rs.size() / HeapWordSize),
1652                              G1CardTable::heap_map_factor());
1653 
1654   G1RegionToSpaceMapper* card_counts_storage =
1655     create_aux_memory_mapper("Card Counts Table",
1656                              G1CardCounts::compute_size(heap_rs.size() / HeapWordSize),
1657                              G1CardCounts::heap_map_factor());
1658 
1659   size_t bitmap_size = G1CMBitMap::compute_size(heap_rs.size());
1660   G1RegionToSpaceMapper* prev_bitmap_storage =
1661     create_aux_memory_mapper("Prev Bitmap", bitmap_size, G1CMBitMap::heap_map_factor());
1662   G1RegionToSpaceMapper* next_bitmap_storage =
1663     create_aux_memory_mapper("Next Bitmap", bitmap_size, G1CMBitMap::heap_map_factor());
1664 
1665   _hrm = HeapRegionManager::create_manager(this);
1666 
1667   _hrm->initialize(heap_storage, prev_bitmap_storage, next_bitmap_storage, bot_storage, cardtable_storage, card_counts_storage);
1668   _card_table->initialize(cardtable_storage);
1669 
1670   // Do later initialization work for concurrent refinement.
1671   _hot_card_cache->initialize(card_counts_storage);
1672 
1673   // 6843694 - ensure that the maximum region index can fit
1674   // in the remembered set structures.
1675   const uint max_region_idx = (1U << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1;
1676   guarantee((max_regions() - 1) <= max_region_idx, "too many regions");
1677 
1678   // The G1FromCardCache reserves card with value 0 as "invalid", so the heap must not
1679   // start within the first card.
1680   guarantee(heap_rs.base() >= (char*)G1CardTable::card_size, "Java heap must not start within the first card.");
1681   // Also create a G1 rem set.
1682   _rem_set = new G1RemSet(this, _card_table, _hot_card_cache);
1683   _rem_set->initialize(max_regions());
1684 
1685   size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1;
1686   guarantee(HeapRegion::CardsPerRegion > 0, "make sure it's initialized");
1687   guarantee(HeapRegion::CardsPerRegion < max_cards_per_region,
1688             "too many cards per region");
1689 
1690   FreeRegionList::set_unrealistically_long_length(max_expandable_regions() + 1);
1691 
1692   _bot = new G1BlockOffsetTable(reserved(), bot_storage);
1693 
1694   {
1695     size_t granularity = HeapRegion::GrainBytes;
1696 
1697     _region_attr.initialize(reserved(), granularity);
1698     _humongous_reclaim_candidates.initialize(reserved(), granularity);
1699   }
1700 


< prev index next >