< prev index next >

src/share/vm/memory/filemap.cpp

Print this page




 864   } else {
 865     return _space[idx]._addr._base;
 866   }
 867 }
 868 
 869 int FileMapInfo::FileMapHeader::compute_crc() {
 870   char* header = data();
 871   // start computing from the field after _crc
 872   char* buf = (char*)&_crc + sizeof(int);
 873   size_t sz = data_size() - (buf - header);
 874   int crc = ClassLoader::crc32(0, buf, (jint)sz);
 875   return crc;
 876 }
 877 
 878 bool FileMapInfo::FileMapHeader::validate() {
 879   if (VerifySharedSpaces && compute_crc() != _crc) {
 880     fail_continue("Header checksum verification failed.");
 881     return false;
 882   }
 883 
 884   if (Arguments::get_xpatchprefix() != NULL) {
 885     FileMapInfo::fail_continue("The shared archive file cannot be used with -Xpatch.");
 886     return false;
 887   }
 888 
 889   if (_version != current_version()) {
 890     FileMapInfo::fail_continue("The shared archive file is the wrong version.");
 891     return false;
 892   }
 893   if (_magic != (int)0xf00baba2) {
 894     FileMapInfo::fail_continue("The shared archive file has a bad magic number.");
 895     return false;
 896   }
 897   char header_version[JVM_IDENT_MAX];
 898   get_header_version(header_version);
 899   if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) {
 900     log_info(class, path)("expected: %s", header_version);
 901     log_info(class, path)("actual:   %s", _jvm_ident);
 902     FileMapInfo::fail_continue("The shared archive file was created by a different"
 903                   " version or build of HotSpot");
 904     return false;
 905   }




 864   } else {
 865     return _space[idx]._addr._base;
 866   }
 867 }
 868 
 869 int FileMapInfo::FileMapHeader::compute_crc() {
 870   char* header = data();
 871   // start computing from the field after _crc
 872   char* buf = (char*)&_crc + sizeof(int);
 873   size_t sz = data_size() - (buf - header);
 874   int crc = ClassLoader::crc32(0, buf, (jint)sz);
 875   return crc;
 876 }
 877 
 878 bool FileMapInfo::FileMapHeader::validate() {
 879   if (VerifySharedSpaces && compute_crc() != _crc) {
 880     fail_continue("Header checksum verification failed.");
 881     return false;
 882   }
 883 
 884   if (Arguments::get_patch_mod_prefix() != NULL) {
 885     FileMapInfo::fail_continue("The shared archive file cannot be used with --patch-module.");
 886     return false;
 887   }
 888 
 889   if (_version != current_version()) {
 890     FileMapInfo::fail_continue("The shared archive file is the wrong version.");
 891     return false;
 892   }
 893   if (_magic != (int)0xf00baba2) {
 894     FileMapInfo::fail_continue("The shared archive file has a bad magic number.");
 895     return false;
 896   }
 897   char header_version[JVM_IDENT_MAX];
 898   get_header_version(header_version);
 899   if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) {
 900     log_info(class, path)("expected: %s", header_version);
 901     log_info(class, path)("actual:   %s", _jvm_ident);
 902     FileMapInfo::fail_continue("The shared archive file was created by a different"
 903                   " version or build of HotSpot");
 904     return false;
 905   }


< prev index next >