comparison src/share/vm/memory/metaspaceShared.cpp @ 11056:221df7e37535

8016075: Win32 crash with CDS enabled and small heap size Summary: Fixed MetaspaceShared::is_in_shared_space Reviewed-by: coleenp, hseigel
author iklam
date Thu, 27 Jun 2013 10:03:21 -0700
parents a1ebd310d5c1
children 740e263c80c6
comparison
equal deleted inserted replaced
11055:8eb40545e209 11056:221df7e37535
824 } 824 }
825 825
826 bool reading() const { return true; } 826 bool reading() const { return true; }
827 }; 827 };
828 828
829
830 // Save bounds of shared spaces mapped in.
831 static char* _ro_base = NULL;
832 static char* _rw_base = NULL;
833 static char* _md_base = NULL;
834 static char* _mc_base = NULL;
835
836 // Return true if given address is in the mapped shared space. 829 // Return true if given address is in the mapped shared space.
837 bool MetaspaceShared::is_in_shared_space(const void* p) { 830 bool MetaspaceShared::is_in_shared_space(const void* p) {
838 if (_ro_base == NULL || _rw_base == NULL) { 831 return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_space(p);
839 return false;
840 } else {
841 return ((p >= _ro_base && p < (_ro_base + SharedReadOnlySize)) ||
842 (p >= _rw_base && p < (_rw_base + SharedReadWriteSize)));
843 }
844 } 832 }
845 833
846 void MetaspaceShared::print_shared_spaces() { 834 void MetaspaceShared::print_shared_spaces() {
847 gclog_or_tty->print_cr("Shared Spaces:"); 835 if (UseSharedSpaces) {
848 gclog_or_tty->print(" read-only " INTPTR_FORMAT "-" INTPTR_FORMAT, 836 FileMapInfo::current_info()->print_shared_spaces();
849 _ro_base, _ro_base + SharedReadOnlySize); 837 }
850 gclog_or_tty->print(" read-write " INTPTR_FORMAT "-" INTPTR_FORMAT,
851 _rw_base, _rw_base + SharedReadWriteSize);
852 gclog_or_tty->cr();
853 gclog_or_tty->print(" misc-data " INTPTR_FORMAT "-" INTPTR_FORMAT,
854 _md_base, _md_base + SharedMiscDataSize);
855 gclog_or_tty->print(" misc-code " INTPTR_FORMAT "-" INTPTR_FORMAT,
856 _mc_base, _mc_base + SharedMiscCodeSize);
857 gclog_or_tty->cr();
858 } 838 }
859 839
860 840
861 // Map shared spaces at requested addresses and return if succeeded. 841 // Map shared spaces at requested addresses and return if succeeded.
862 // Need to keep the bounds of the ro and rw space for the Metaspace::contains 842 // Need to keep the bounds of the ro and rw space for the Metaspace::contains
871 ReservedSpace shared_rs = mapinfo->reserve_shared_memory(); 851 ReservedSpace shared_rs = mapinfo->reserve_shared_memory();
872 if (!shared_rs.is_reserved()) return false; 852 if (!shared_rs.is_reserved()) return false;
873 #endif 853 #endif
874 854
875 assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces"); 855 assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
856
857 char* _ro_base = NULL;
858 char* _rw_base = NULL;
859 char* _md_base = NULL;
860 char* _mc_base = NULL;
876 861
877 // Map each shared region 862 // Map each shared region
878 if ((_ro_base = mapinfo->map_region(ro)) != NULL && 863 if ((_ro_base = mapinfo->map_region(ro)) != NULL &&
879 (_rw_base = mapinfo->map_region(rw)) != NULL && 864 (_rw_base = mapinfo->map_region(rw)) != NULL &&
880 (_md_base = mapinfo->map_region(md)) != NULL && 865 (_md_base = mapinfo->map_region(md)) != NULL &&