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

Print this page




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




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