Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/universe.cpp @ 23466:92a6cfbf2d94
8022865: [TESTBUG] Compressed Oops testing needs to be revised
Summary: Rewrote compressed oops tests
Reviewed-by: kvn, coleenp, mseledtsov
author | dbuck |
---|---|
date | Tue, 08 Dec 2015 14:23:56 +0000 |
parents | d3f3f7677537 |
children | 88ae10297731 |
comparison
equal
deleted
inserted
replaced
23465:3ad3f93fe3d2 | 23466:92a6cfbf2d94 |
---|---|
845 // This also makes implicit null checking work, because the | 845 // This also makes implicit null checking work, because the |
846 // memory+1 page below heap_base needs to cause a signal. | 846 // memory+1 page below heap_base needs to cause a signal. |
847 // See needs_explicit_null_check. | 847 // See needs_explicit_null_check. |
848 // Only set the heap base for compressed oops because it indicates | 848 // Only set the heap base for compressed oops because it indicates |
849 // compressed oops for pstack code. | 849 // compressed oops for pstack code. |
850 bool verbose = PrintCompressedOopsMode || (PrintMiscellaneous && Verbose); | |
851 if (verbose) { | |
852 tty->cr(); | |
853 tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB", | |
854 Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M); | |
855 } | |
856 if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax)) { | 850 if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax)) { |
857 // Can't reserve heap below 32Gb. | 851 // Can't reserve heap below 32Gb. |
858 // keep the Universe::narrow_oop_base() set in Universe::reserve_heap() | 852 // keep the Universe::narrow_oop_base() set in Universe::reserve_heap() |
859 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); | 853 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); |
860 #ifdef AIX | 854 #ifdef AIX |
861 // There is no protected page before the heap. This assures all oops | 855 // There is no protected page before the heap. This assures all oops |
862 // are decoded so that NULL is preserved, so this page will not be accessed. | 856 // are decoded so that NULL is preserved, so this page will not be accessed. |
863 Universe::set_narrow_oop_use_implicit_null_checks(false); | 857 Universe::set_narrow_oop_use_implicit_null_checks(false); |
864 #endif | 858 #endif |
865 if (verbose) { | |
866 tty->print(", %s: "PTR_FORMAT, | |
867 narrow_oop_mode_to_string(HeapBasedNarrowOop), | |
868 Universe::narrow_oop_base()); | |
869 } | |
870 } else { | 859 } else { |
871 Universe::set_narrow_oop_base(0); | 860 Universe::set_narrow_oop_base(0); |
872 if (verbose) { | |
873 tty->print(", %s", narrow_oop_mode_to_string(ZeroBasedNarrowOop)); | |
874 } | |
875 #ifdef _WIN64 | 861 #ifdef _WIN64 |
876 if (!Universe::narrow_oop_use_implicit_null_checks()) { | 862 if (!Universe::narrow_oop_use_implicit_null_checks()) { |
877 // Don't need guard page for implicit checks in indexed addressing | 863 // Don't need guard page for implicit checks in indexed addressing |
878 // mode with zero based Compressed Oops. | 864 // mode with zero based Compressed Oops. |
879 Universe::set_narrow_oop_use_implicit_null_checks(true); | 865 Universe::set_narrow_oop_use_implicit_null_checks(true); |
882 if((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) { | 868 if((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) { |
883 // Can't reserve heap below 4Gb. | 869 // Can't reserve heap below 4Gb. |
884 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); | 870 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); |
885 } else { | 871 } else { |
886 Universe::set_narrow_oop_shift(0); | 872 Universe::set_narrow_oop_shift(0); |
887 if (verbose) { | |
888 tty->print(", %s", narrow_oop_mode_to_string(UnscaledNarrowOop)); | |
889 } | |
890 } | 873 } |
891 } | 874 } |
892 | 875 |
893 if (verbose) { | |
894 tty->cr(); | |
895 tty->cr(); | |
896 } | |
897 Universe::set_narrow_ptrs_base(Universe::narrow_oop_base()); | 876 Universe::set_narrow_ptrs_base(Universe::narrow_oop_base()); |
877 | |
878 if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { | |
879 Universe::print_compressed_oops_mode(); | |
880 } | |
898 } | 881 } |
899 // Universe::narrow_oop_base() is one page below the heap. | 882 // Universe::narrow_oop_base() is one page below the heap. |
900 assert((intptr_t)Universe::narrow_oop_base() <= (intptr_t)(Universe::heap()->base() - | 883 assert((intptr_t)Universe::narrow_oop_base() <= (intptr_t)(Universe::heap()->base() - |
901 os::vm_page_size()) || | 884 os::vm_page_size()) || |
902 Universe::narrow_oop_base() == NULL, "invalid value"); | 885 Universe::narrow_oop_base() == NULL, "invalid value"); |
913 ThreadLocalAllocBuffer::startup_initialization(); | 896 ThreadLocalAllocBuffer::startup_initialization(); |
914 } | 897 } |
915 return JNI_OK; | 898 return JNI_OK; |
916 } | 899 } |
917 | 900 |
901 void Universe::print_compressed_oops_mode() { | |
902 tty->cr(); | |
903 tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB", | |
904 Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M); | |
905 | |
906 tty->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode())); | |
907 | |
908 if (Universe::narrow_oop_base() != 0) { | |
909 tty->print(":" PTR_FORMAT, Universe::narrow_oop_base()); | |
910 } | |
911 | |
912 if (Universe::narrow_oop_shift() != 0) { | |
913 tty->print(", Oop shift amount: %d", Universe::narrow_oop_shift()); | |
914 } | |
915 | |
916 tty->cr(); | |
917 tty->cr(); | |
918 } | |
918 | 919 |
919 // Reserve the Java heap, which is now the same for all GCs. | 920 // Reserve the Java heap, which is now the same for all GCs. |
920 ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { | 921 ReservedSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { |
921 assert(alignment <= Arguments::conservative_max_heap_alignment(), | 922 assert(alignment <= Arguments::conservative_max_heap_alignment(), |
922 err_msg("actual alignment "SIZE_FORMAT" must be within maximum heap alignment "SIZE_FORMAT, | 923 err_msg("actual alignment "SIZE_FORMAT" must be within maximum heap alignment "SIZE_FORMAT, |
982 | 983 |
983 | 984 |
984 const char* Universe::narrow_oop_mode_to_string(Universe::NARROW_OOP_MODE mode) { | 985 const char* Universe::narrow_oop_mode_to_string(Universe::NARROW_OOP_MODE mode) { |
985 switch (mode) { | 986 switch (mode) { |
986 case UnscaledNarrowOop: | 987 case UnscaledNarrowOop: |
987 return "32-bits Oops"; | 988 return "32-bit"; |
988 case ZeroBasedNarrowOop: | 989 case ZeroBasedNarrowOop: |
989 return "zero based Compressed Oops"; | 990 return "Zero based"; |
990 case HeapBasedNarrowOop: | 991 case HeapBasedNarrowOop: |
991 return "Compressed Oops with base"; | 992 return "Non-zero based"; |
992 } | 993 } |
993 | 994 |
994 ShouldNotReachHere(); | 995 ShouldNotReachHere(); |
995 return ""; | 996 return ""; |
996 } | 997 } |