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

Print this page




1723          "Flag should have been handled and cleared prior to this point");
1724 
1725   // What else?  We might try synchronous finalization later.  If the total
1726   // space available is large enough for the allocation, then a more
1727   // complete compaction phase than we've tried so far might be
1728   // appropriate.
1729   assert(*succeeded, "sanity");
1730   return NULL;
1731 }
1732 
1733 // Attempting to expand the heap sufficiently
1734 // to support an allocation of the given "word_size".  If
1735 // successful, perform the allocation and return the address of the
1736 // allocated block, or else "NULL".
1737 
1738 HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {
1739   assert_at_safepoint(true /* should_be_vm_thread */);
1740 
1741   verify_region_sets_optional();
1742 
1743   size_t expand_bytes = MAX2(word_size * HeapWordSize, MinHeapDeltaBytes);
1744   ergo_verbose1(ErgoHeapSizing,
1745                 "attempt heap expansion",
1746                 ergo_format_reason("allocation request failed")
1747                 ergo_format_byte("allocation request"),
1748                 word_size * HeapWordSize);
1749   if (expand(expand_bytes)) {
1750     _hrs.verify_optional();
1751     verify_region_sets_optional();
1752     return attempt_allocation_at_safepoint(word_size,
1753                                  false /* expect_null_mutator_alloc_region */);
1754   }
1755   return NULL;
1756 }
1757 
1758 void G1CollectedHeap::update_committed_space(HeapWord* old_end,
1759                                              HeapWord* new_end) {
1760   assert(old_end != new_end, "don't call this otherwise");
1761   assert((HeapWord*) _g1_storage.high() == new_end, "invariant");
1762 
1763   // Update the committed mem region.




1723          "Flag should have been handled and cleared prior to this point");
1724 
1725   // What else?  We might try synchronous finalization later.  If the total
1726   // space available is large enough for the allocation, then a more
1727   // complete compaction phase than we've tried so far might be
1728   // appropriate.
1729   assert(*succeeded, "sanity");
1730   return NULL;
1731 }
1732 
1733 // Attempting to expand the heap sufficiently
1734 // to support an allocation of the given "word_size".  If
1735 // successful, perform the allocation and return the address of the
1736 // allocated block, or else "NULL".
1737 
1738 HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {
1739   assert_at_safepoint(true /* should_be_vm_thread */);
1740 
1741   verify_region_sets_optional();
1742 
1743   size_t expand_bytes = MAX2(word_size * HeapWordSize, (size_t)MinHeapDeltaBytes);
1744   ergo_verbose1(ErgoHeapSizing,
1745                 "attempt heap expansion",
1746                 ergo_format_reason("allocation request failed")
1747                 ergo_format_byte("allocation request"),
1748                 word_size * HeapWordSize);
1749   if (expand(expand_bytes)) {
1750     _hrs.verify_optional();
1751     verify_region_sets_optional();
1752     return attempt_allocation_at_safepoint(word_size,
1753                                  false /* expect_null_mutator_alloc_region */);
1754   }
1755   return NULL;
1756 }
1757 
1758 void G1CollectedHeap::update_committed_space(HeapWord* old_end,
1759                                              HeapWord* new_end) {
1760   assert(old_end != new_end, "don't call this otherwise");
1761   assert((HeapWord*) _g1_storage.high() == new_end, "invariant");
1762 
1763   // Update the committed mem region.