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