< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page




 795     st->print(", no protected page in front of the heap");
 796   }
 797   st->cr();
 798 }
 799 
 800 ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) {
 801 
 802   assert(alignment <= Arguments::conservative_max_heap_alignment(),
 803          "actual alignment " SIZE_FORMAT " must be within maximum heap alignment " SIZE_FORMAT,
 804          alignment, Arguments::conservative_max_heap_alignment());
 805 
 806   size_t total_reserved = align_up(heap_size, alignment);
 807   assert(!UseCompressedOops || (total_reserved <= (OopEncodingHeapMax - os::vm_page_size())),
 808       "heap size is too big for compressed oops");
 809 
 810   bool use_large_pages = UseLargePages && is_aligned(alignment, os::large_page_size());
 811   assert(!UseLargePages
 812       || UseParallelGC
 813       || use_large_pages, "Wrong alignment to use large pages");
 814 




 815   // Now create the space.
 816   ReservedHeapSpace total_rs(total_reserved, alignment, use_large_pages, AllocateHeapAt);
 817 
 818   if (total_rs.is_reserved()) {
 819     assert((total_reserved == total_rs.size()) && ((uintptr_t)total_rs.base() % alignment == 0),
 820            "must be exactly of required size and alignment");
 821     // We are good.
 822 
 823     if (UseCompressedOops) {
 824       // Universe::initialize_heap() will reset this to NULL if unscaled
 825       // or zero-based narrow oops are actually used.
 826       // Else heap start and base MUST differ, so that NULL can be encoded nonambigous.
 827       Universe::set_narrow_oop_base((address)total_rs.compressed_oop_base());
 828     }
 829 
 830     if (AllocateHeapAt != NULL) {
 831       log_info(gc,heap)("Successfully allocated Java heap at location %s", AllocateHeapAt);
 832     }
 833     return total_rs;
 834   }




 795     st->print(", no protected page in front of the heap");
 796   }
 797   st->cr();
 798 }
 799 
 800 ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) {
 801 
 802   assert(alignment <= Arguments::conservative_max_heap_alignment(),
 803          "actual alignment " SIZE_FORMAT " must be within maximum heap alignment " SIZE_FORMAT,
 804          alignment, Arguments::conservative_max_heap_alignment());
 805 
 806   size_t total_reserved = align_up(heap_size, alignment);
 807   assert(!UseCompressedOops || (total_reserved <= (OopEncodingHeapMax - os::vm_page_size())),
 808       "heap size is too big for compressed oops");
 809 
 810   bool use_large_pages = UseLargePages && is_aligned(alignment, os::large_page_size());
 811   assert(!UseLargePages
 812       || UseParallelGC
 813       || use_large_pages, "Wrong alignment to use large pages");
 814 
 815   // When AllocateOldGenAt is set, we cannot use largepages for entire heap memory.
 816   // Only young gen which is allocated in dram can use large pages, but we currently don't support that.
 817   use_large_pages = (AllocateOldGenAt != NULL) ? false : use_large_pages;
 818 
 819   // Now create the space.
 820   ReservedHeapSpace total_rs(total_reserved, alignment, use_large_pages, AllocateHeapAt);
 821 
 822   if (total_rs.is_reserved()) {
 823     assert((total_reserved == total_rs.size()) && ((uintptr_t)total_rs.base() % alignment == 0),
 824            "must be exactly of required size and alignment");
 825     // We are good.
 826 
 827     if (UseCompressedOops) {
 828       // Universe::initialize_heap() will reset this to NULL if unscaled
 829       // or zero-based narrow oops are actually used.
 830       // Else heap start and base MUST differ, so that NULL can be encoded nonambigous.
 831       Universe::set_narrow_oop_base((address)total_rs.compressed_oop_base());
 832     }
 833 
 834     if (AllocateHeapAt != NULL) {
 835       log_info(gc,heap)("Successfully allocated Java heap at location %s", AllocateHeapAt);
 836     }
 837     return total_rs;
 838   }


< prev index next >