< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page




 790   if (Universe::narrow_oop_shift() != 0) {
 791     st->print(", Oop shift amount: %d", Universe::narrow_oop_shift());
 792   }
 793 
 794   if (!Universe::narrow_oop_use_implicit_null_checks()) {
 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   // When AllocateOldGenAt is set, we cannot use largepages for entire heap memory.
 811   // Only young gen which is allocated in dram can use large pages, but we currently don't support that.
 812   bool use_large_pages = (AllocateOldGenAt != NULL) && UseLargePages && is_aligned(alignment, os::large_page_size());
 813   assert(!UseLargePages
 814       || UseParallelGC
 815       || use_large_pages, "Wrong alignment to use large pages");




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




 790   if (Universe::narrow_oop_shift() != 0) {
 791     st->print(", Oop shift amount: %d", Universe::narrow_oop_shift());
 792   }
 793 
 794   if (!Universe::narrow_oop_use_implicit_null_checks()) {
 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;


< prev index next >