730 // UnscaledNarrowOop encoding didn't work, and no base was found for ZeroBasedOops or
731 // HeapBasedNarrowOop encoding was requested. So, can't reserve below 32Gb.
732 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
733 }
734
735 // Set narrow_oop_base and narrow_oop_use_implicit_null_checks
736 // used in ReservedHeapSpace() constructors.
737 // The final values will be set in initialize_heap() below.
738 if ((base != 0) && ((base + heap_size) <= OopEncodingHeapMax) &&
739 (!UseCompressedKlassPointers || (base + Universe::class_metaspace_size()) <= KlassEncodingMetaspaceMax)) {
740 // Use zero based compressed oops
741 Universe::set_narrow_oop_base(NULL);
742 // Don't need guard page for implicit checks in indexed
743 // addressing mode with zero based Compressed Oops.
744 Universe::set_narrow_oop_use_implicit_null_checks(true);
745 } else {
746 // Set to a non-NULL value so the ReservedSpace ctor computes
747 // the correct no-access prefix.
748 // The final value will be set in initialize_heap() below.
749 Universe::set_narrow_oop_base((address)NarrowOopHeapMax);
750 #ifdef _WIN64
751 if (UseLargePages) {
752 // Cannot allocate guard pages for implicit checks in indexed
753 // addressing mode when large pages are specified on windows.
754 Universe::set_narrow_oop_use_implicit_null_checks(false);
755 }
756 #endif // _WIN64
757 }
758 }
759 #endif
760 return (char*)base; // also return NULL (don't care) for 32-bit VM
761 }
762
763 jint Universe::initialize_heap() {
764
765 if (UseParallelGC) {
766 #if INCLUDE_ALL_GCS
767 Universe::_collectedHeap = new ParallelScavengeHeap();
768 #else // INCLUDE_ALL_GCS
769 fatal("UseParallelGC not supported in this VM.");
770 #endif // INCLUDE_ALL_GCS
808 #ifdef _LP64
809 if (UseCompressedOops) {
810 // Subtract a page because something can get allocated at heap base.
811 // This also makes implicit null checking work, because the
812 // memory+1 page below heap_base needs to cause a signal.
813 // See needs_explicit_null_check.
814 // Only set the heap base for compressed oops because it indicates
815 // compressed oops for pstack code.
816 bool verbose = PrintCompressedOopsMode || (PrintMiscellaneous && Verbose);
817 if (verbose) {
818 tty->cr();
819 tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
820 Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M);
821 }
822 if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax) ||
823 (UseCompressedKlassPointers &&
824 ((uint64_t)Universe::heap()->base() + Universe::class_metaspace_size() > KlassEncodingMetaspaceMax))) {
825 // Can't reserve heap below 32Gb.
826 // keep the Universe::narrow_oop_base() set in Universe::reserve_heap()
827 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
828 if (verbose) {
829 tty->print(", %s: "PTR_FORMAT,
830 narrow_oop_mode_to_string(HeapBasedNarrowOop),
831 Universe::narrow_oop_base());
832 }
833 } else {
834 Universe::set_narrow_oop_base(0);
835 if (verbose) {
836 tty->print(", %s", narrow_oop_mode_to_string(ZeroBasedNarrowOop));
837 }
838 #ifdef _WIN64
839 if (!Universe::narrow_oop_use_implicit_null_checks()) {
840 // Don't need guard page for implicit checks in indexed addressing
841 // mode with zero based Compressed Oops.
842 Universe::set_narrow_oop_use_implicit_null_checks(true);
843 }
844 #endif // _WIN64
845 if((uint64_t)Universe::heap()->reserved_region().end() > NarrowOopHeapMax) {
846 // Can't reserve heap below 4Gb.
847 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
|
730 // UnscaledNarrowOop encoding didn't work, and no base was found for ZeroBasedOops or
731 // HeapBasedNarrowOop encoding was requested. So, can't reserve below 32Gb.
732 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
733 }
734
735 // Set narrow_oop_base and narrow_oop_use_implicit_null_checks
736 // used in ReservedHeapSpace() constructors.
737 // The final values will be set in initialize_heap() below.
738 if ((base != 0) && ((base + heap_size) <= OopEncodingHeapMax) &&
739 (!UseCompressedKlassPointers || (base + Universe::class_metaspace_size()) <= KlassEncodingMetaspaceMax)) {
740 // Use zero based compressed oops
741 Universe::set_narrow_oop_base(NULL);
742 // Don't need guard page for implicit checks in indexed
743 // addressing mode with zero based Compressed Oops.
744 Universe::set_narrow_oop_use_implicit_null_checks(true);
745 } else {
746 // Set to a non-NULL value so the ReservedSpace ctor computes
747 // the correct no-access prefix.
748 // The final value will be set in initialize_heap() below.
749 Universe::set_narrow_oop_base((address)NarrowOopHeapMax);
750 #if defined(_WIN64) || defined(AIX)
751 if (UseLargePages) {
752 // Cannot allocate guard pages for implicit checks in indexed
753 // addressing mode when large pages are specified on windows.
754 Universe::set_narrow_oop_use_implicit_null_checks(false);
755 }
756 #endif // _WIN64
757 }
758 }
759 #endif
760 return (char*)base; // also return NULL (don't care) for 32-bit VM
761 }
762
763 jint Universe::initialize_heap() {
764
765 if (UseParallelGC) {
766 #if INCLUDE_ALL_GCS
767 Universe::_collectedHeap = new ParallelScavengeHeap();
768 #else // INCLUDE_ALL_GCS
769 fatal("UseParallelGC not supported in this VM.");
770 #endif // INCLUDE_ALL_GCS
808 #ifdef _LP64
809 if (UseCompressedOops) {
810 // Subtract a page because something can get allocated at heap base.
811 // This also makes implicit null checking work, because the
812 // memory+1 page below heap_base needs to cause a signal.
813 // See needs_explicit_null_check.
814 // Only set the heap base for compressed oops because it indicates
815 // compressed oops for pstack code.
816 bool verbose = PrintCompressedOopsMode || (PrintMiscellaneous && Verbose);
817 if (verbose) {
818 tty->cr();
819 tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
820 Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M);
821 }
822 if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax) ||
823 (UseCompressedKlassPointers &&
824 ((uint64_t)Universe::heap()->base() + Universe::class_metaspace_size() > KlassEncodingMetaspaceMax))) {
825 // Can't reserve heap below 32Gb.
826 // keep the Universe::narrow_oop_base() set in Universe::reserve_heap()
827 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
828 #ifdef AIX
829 // There is no protected page before the heap. This assures all oops
830 // are decoded so that NULL is preserverd, so this page will not be accessed.
831 Universe::set_narrow_oop_use_implicit_null_checks(false);
832 #endif
833 if (verbose) {
834 tty->print(", %s: "PTR_FORMAT,
835 narrow_oop_mode_to_string(HeapBasedNarrowOop),
836 Universe::narrow_oop_base());
837 }
838 } else {
839 Universe::set_narrow_oop_base(0);
840 if (verbose) {
841 tty->print(", %s", narrow_oop_mode_to_string(ZeroBasedNarrowOop));
842 }
843 #ifdef _WIN64
844 if (!Universe::narrow_oop_use_implicit_null_checks()) {
845 // Don't need guard page for implicit checks in indexed addressing
846 // mode with zero based Compressed Oops.
847 Universe::set_narrow_oop_use_implicit_null_checks(true);
848 }
849 #endif // _WIN64
850 if((uint64_t)Universe::heap()->reserved_region().end() > NarrowOopHeapMax) {
851 // Can't reserve heap below 4Gb.
852 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
|