936 // Param: 937 // p, The given pointer 938 // Return: 939 // True if the p is within the mapped shared space, otherwise, false. 940 bool FileMapInfo::is_in_shared_space(const void* p) { 941 for (int i = 0; i < MetaspaceShared::n_regions; i++) { 942 char *base; 943 if (MetaspaceShared::is_string_region(i) && _header->_space[i]._used == 0) { 944 continue; 945 } 946 base = _header->region_addr(i); 947 if (p >= base && p < base + _header->_space[i]._used) { 948 return true; 949 } 950 } 951 952 return false; 953 } 954 955 void FileMapInfo::print_shared_spaces() { 956 gclog_or_tty->print_cr("Shared Spaces:"); 957 for (int i = 0; i < MetaspaceShared::n_regions; i++) { 958 struct FileMapInfo::FileMapHeader::space_info* si = &_header->_space[i]; 959 char *base = _header->region_addr(i); 960 gclog_or_tty->print(" %s " INTPTR_FORMAT "-" INTPTR_FORMAT, 961 shared_region_name[i], 962 p2i(base), p2i(base + si->_used)); 963 } 964 } 965 966 // Unmap mapped regions of shared space. 967 void FileMapInfo::stop_sharing_and_unmap(const char* msg) { 968 FileMapInfo *map_info = FileMapInfo::current_info(); 969 if (map_info) { 970 map_info->fail_continue("%s", msg); 971 for (int i = 0; i < MetaspaceShared::num_non_strings; i++) { 972 char *addr = map_info->_header->region_addr(i); 973 if (addr != NULL && !MetaspaceShared::is_string_region(i)) { 974 map_info->unmap_region(i); 975 map_info->_header->_space[i]._addr._base = NULL; 976 } 977 } 978 // Dealloc the string regions only without unmapping. The string regions are part 979 // of the java heap. Unmapping of the heap regions are managed by GC. 980 map_info->dealloc_string_regions(); | 936 // Param: 937 // p, The given pointer 938 // Return: 939 // True if the p is within the mapped shared space, otherwise, false. 940 bool FileMapInfo::is_in_shared_space(const void* p) { 941 for (int i = 0; i < MetaspaceShared::n_regions; i++) { 942 char *base; 943 if (MetaspaceShared::is_string_region(i) && _header->_space[i]._used == 0) { 944 continue; 945 } 946 base = _header->region_addr(i); 947 if (p >= base && p < base + _header->_space[i]._used) { 948 return true; 949 } 950 } 951 952 return false; 953 } 954 955 void FileMapInfo::print_shared_spaces() { 956 tty->print_cr("Shared Spaces:"); 957 for (int i = 0; i < MetaspaceShared::n_regions; i++) { 958 struct FileMapInfo::FileMapHeader::space_info* si = &_header->_space[i]; 959 char *base = _header->region_addr(i); 960 tty->print(" %s " INTPTR_FORMAT "-" INTPTR_FORMAT, 961 shared_region_name[i], 962 p2i(base), p2i(base + si->_used)); 963 } 964 } 965 966 // Unmap mapped regions of shared space. 967 void FileMapInfo::stop_sharing_and_unmap(const char* msg) { 968 FileMapInfo *map_info = FileMapInfo::current_info(); 969 if (map_info) { 970 map_info->fail_continue("%s", msg); 971 for (int i = 0; i < MetaspaceShared::num_non_strings; i++) { 972 char *addr = map_info->_header->region_addr(i); 973 if (addr != NULL && !MetaspaceShared::is_string_region(i)) { 974 map_info->unmap_region(i); 975 map_info->_header->_space[i]._addr._base = NULL; 976 } 977 } 978 // Dealloc the string regions only without unmapping. The string regions are part 979 // of the java heap. Unmapping of the heap regions are managed by GC. 980 map_info->dealloc_string_regions(); |