894 } else { 895 return _space[idx]._addr._base; 896 } 897 } 898 899 int FileMapInfo::FileMapHeader::compute_crc() { 900 char* header = data(); 901 // start computing from the field after _crc 902 char* buf = (char*)&_crc + sizeof(int); 903 size_t sz = data_size() - (buf - header); 904 int crc = ClassLoader::crc32(0, buf, (jint)sz); 905 return crc; 906 } 907 908 bool FileMapInfo::FileMapHeader::validate() { 909 if (VerifySharedSpaces && compute_crc() != _crc) { 910 fail_continue("Header checksum verification failed."); 911 return false; 912 } 913 914 if (Arguments::get_patch_mod_prefix() != NULL) { 915 FileMapInfo::fail_continue("The shared archive file cannot be used with --patch-module."); 916 return false; 917 } 918 919 if (!Arguments::has_jimage()) { 920 FileMapInfo::fail_continue("The shared archive file cannot be used with an exploded module build."); 921 return false; 922 } 923 924 if (_version != current_version()) { 925 FileMapInfo::fail_continue("The shared archive file is the wrong version."); 926 return false; 927 } 928 if (_magic != (int)0xf00baba2) { 929 FileMapInfo::fail_continue("The shared archive file has a bad magic number."); 930 return false; 931 } 932 char header_version[JVM_IDENT_MAX]; 933 get_header_version(header_version); 934 if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) { 935 log_info(class, path)("expected: %s", header_version); 936 log_info(class, path)("actual: %s", _jvm_ident); 937 FileMapInfo::fail_continue("The shared archive file was created by a different" 938 " version or build of HotSpot"); | 894 } else { 895 return _space[idx]._addr._base; 896 } 897 } 898 899 int FileMapInfo::FileMapHeader::compute_crc() { 900 char* header = data(); 901 // start computing from the field after _crc 902 char* buf = (char*)&_crc + sizeof(int); 903 size_t sz = data_size() - (buf - header); 904 int crc = ClassLoader::crc32(0, buf, (jint)sz); 905 return crc; 906 } 907 908 bool FileMapInfo::FileMapHeader::validate() { 909 if (VerifySharedSpaces && compute_crc() != _crc) { 910 fail_continue("Header checksum verification failed."); 911 return false; 912 } 913 914 if (!Arguments::has_jimage()) { 915 FileMapInfo::fail_continue("The shared archive file cannot be used with an exploded module build."); 916 return false; 917 } 918 919 if (_version != current_version()) { 920 FileMapInfo::fail_continue("The shared archive file is the wrong version."); 921 return false; 922 } 923 if (_magic != (int)0xf00baba2) { 924 FileMapInfo::fail_continue("The shared archive file has a bad magic number."); 925 return false; 926 } 927 char header_version[JVM_IDENT_MAX]; 928 get_header_version(header_version); 929 if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) { 930 log_info(class, path)("expected: %s", header_version); 931 log_info(class, path)("actual: %s", _jvm_ident); 932 FileMapInfo::fail_continue("The shared archive file was created by a different" 933 " version or build of HotSpot"); |