src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc Sdiff src/share/vm/gc_implementation/g1

src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page




1755   }
1756   return NULL;
1757 }
1758 
1759 void G1CollectedHeap::update_committed_space(HeapWord* old_end,
1760                                              HeapWord* new_end) {
1761   assert(old_end != new_end, "don't call this otherwise");
1762   assert((HeapWord*) _g1_storage.high() == new_end, "invariant");
1763 
1764   // Update the committed mem region.
1765   _g1_committed.set_end(new_end);
1766   // Tell the card table about the update.
1767   Universe::heap()->barrier_set()->resize_covered_region(_g1_committed);
1768   // Tell the BOT about the update.
1769   _bot_shared->resize(_g1_committed.word_size());
1770   // Tell the hot card cache about the update
1771   _cg1r->hot_card_cache()->resize_card_counts(capacity());
1772 }
1773 
1774 bool G1CollectedHeap::expand(size_t expand_bytes) {







1775   size_t old_mem_size = _g1_storage.committed_size();
1776   size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes);
1777   aligned_expand_bytes = align_size_up(aligned_expand_bytes,
1778                                        HeapRegion::GrainBytes);
1779   ergo_verbose2(ErgoHeapSizing,
1780                 "expand the heap",
1781                 ergo_format_byte("requested expansion amount")
1782                 ergo_format_byte("attempted expansion amount"),
1783                 expand_bytes, aligned_expand_bytes);
1784 
1785   // First commit the memory.
1786   HeapWord* old_end = (HeapWord*) _g1_storage.high();
1787   bool successful = _g1_storage.expand_by(aligned_expand_bytes);
1788   if (successful) {
1789     // Then propagate this update to the necessary data structures.
1790     HeapWord* new_end = (HeapWord*) _g1_storage.high();
1791     update_committed_space(old_end, new_end);
1792 
1793     FreeRegionList expansion_list("Local Expansion List");
1794     MemRegion mr = _hrs.expand_by(old_end, new_end, &expansion_list);




1755   }
1756   return NULL;
1757 }
1758 
1759 void G1CollectedHeap::update_committed_space(HeapWord* old_end,
1760                                              HeapWord* new_end) {
1761   assert(old_end != new_end, "don't call this otherwise");
1762   assert((HeapWord*) _g1_storage.high() == new_end, "invariant");
1763 
1764   // Update the committed mem region.
1765   _g1_committed.set_end(new_end);
1766   // Tell the card table about the update.
1767   Universe::heap()->barrier_set()->resize_covered_region(_g1_committed);
1768   // Tell the BOT about the update.
1769   _bot_shared->resize(_g1_committed.word_size());
1770   // Tell the hot card cache about the update
1771   _cg1r->hot_card_cache()->resize_card_counts(capacity());
1772 }
1773 
1774 bool G1CollectedHeap::expand(size_t expand_bytes) {
1775   if (_g1_storage.uncommitted_size() == 0) {
1776     ergo_verbose0(ErgoHeapSizing,
1777                       "did not expand the heap",
1778                       ergo_format_reason("heap already fully expanded"));
1779     return false;
1780   }
1781 
1782   size_t old_mem_size = _g1_storage.committed_size();
1783   size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes);
1784   aligned_expand_bytes = align_size_up(aligned_expand_bytes,
1785                                        HeapRegion::GrainBytes);
1786   ergo_verbose2(ErgoHeapSizing,
1787                 "expand the heap",
1788                 ergo_format_byte("requested expansion amount")
1789                 ergo_format_byte("attempted expansion amount"),
1790                 expand_bytes, aligned_expand_bytes);
1791 
1792   // First commit the memory.
1793   HeapWord* old_end = (HeapWord*) _g1_storage.high();
1794   bool successful = _g1_storage.expand_by(aligned_expand_bytes);
1795   if (successful) {
1796     // Then propagate this update to the necessary data structures.
1797     HeapWord* new_end = (HeapWord*) _g1_storage.high();
1798     update_committed_space(old_end, new_end);
1799 
1800     FreeRegionList expansion_list("Local Expansion List");
1801     MemRegion mr = _hrs.expand_by(old_end, new_end, &expansion_list);


src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File