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