< prev index next >

src/share/vm/memory/filemap.cpp

Print this page




 151 }
 152 
 153 FileMapInfo::~FileMapInfo() {
 154   assert(_current_info == this, "must be singleton"); // not thread safe
 155   _current_info = NULL;
 156 }
 157 
 158 void FileMapInfo::populate_header(size_t alignment) {
 159   _header->populate(this, alignment);
 160 }
 161 
 162 size_t FileMapInfo::FileMapHeader::data_size() {
 163   return SharedClassUtil::file_map_header_size() - sizeof(FileMapInfo::FileMapHeaderBase);
 164 }
 165 
 166 void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment) {
 167   _magic = 0xf00baba2;
 168   _version = _current_version;
 169   _alignment = alignment;
 170   _obj_alignment = ObjectAlignmentInBytes;

 171   _narrow_oop_mode = Universe::narrow_oop_mode();
 172   _narrow_oop_shift = Universe::narrow_oop_shift();
 173   _max_heap_size = MaxHeapSize;
 174   _narrow_klass_base = Universe::narrow_klass_base();
 175   _narrow_klass_shift = Universe::narrow_klass_shift();
 176   _classpath_entry_table_size = mapinfo->_classpath_entry_table_size;
 177   _classpath_entry_table = mapinfo->_classpath_entry_table;
 178   _classpath_entry_size = mapinfo->_classpath_entry_size;
 179 
 180   // The following fields are for sanity checks for whether this archive
 181   // will function correctly with this JVM and the bootclasspath it's
 182   // invoked with.
 183 
 184   // JVM version string ... changes on each build.
 185   get_header_version(_jvm_ident);
 186 }
 187 
 188 void FileMapInfo::allocate_classpath_entry_table() {
 189   int bytes = 0;
 190   int count = 0;


 881   }
 882   if (_magic != (int)0xf00baba2) {
 883     FileMapInfo::fail_continue("The shared archive file has a bad magic number.");
 884     return false;
 885   }
 886   char header_version[JVM_IDENT_MAX];
 887   get_header_version(header_version);
 888   if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) {
 889     if (TraceClassPaths) {
 890       tty->print_cr("Expected: %s", header_version);
 891       tty->print_cr("Actual:   %s", _jvm_ident);
 892     }
 893     FileMapInfo::fail_continue("The shared archive file was created by a different"
 894                   " version or build of HotSpot");
 895     return false;
 896   }
 897   if (_obj_alignment != ObjectAlignmentInBytes) {
 898     FileMapInfo::fail_continue("The shared archive file's ObjectAlignmentInBytes of %d"
 899                   " does not equal the current ObjectAlignmentInBytes of " INTX_FORMAT ".",
 900                   _obj_alignment, ObjectAlignmentInBytes);







 901     return false;
 902   }
 903 
 904   return true;
 905 }
 906 
 907 bool FileMapInfo::validate_header() {
 908   bool status = _header->validate();
 909 
 910   if (status) {
 911     if (!ClassLoader::check_shared_paths_misc_info(_paths_misc_info, _header->_paths_misc_info_size)) {
 912       if (!PrintSharedArchiveAndExit) {
 913         fail_continue("shared class paths mismatch (hint: enable -XX:+TraceClassPaths to diagnose the failure)");
 914         status = false;
 915       }
 916     }
 917   }
 918 
 919   if (_paths_misc_info != NULL) {
 920     FREE_C_HEAP_ARRAY(char, _paths_misc_info);




 151 }
 152 
 153 FileMapInfo::~FileMapInfo() {
 154   assert(_current_info == this, "must be singleton"); // not thread safe
 155   _current_info = NULL;
 156 }
 157 
 158 void FileMapInfo::populate_header(size_t alignment) {
 159   _header->populate(this, alignment);
 160 }
 161 
 162 size_t FileMapInfo::FileMapHeader::data_size() {
 163   return SharedClassUtil::file_map_header_size() - sizeof(FileMapInfo::FileMapHeaderBase);
 164 }
 165 
 166 void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment) {
 167   _magic = 0xf00baba2;
 168   _version = _current_version;
 169   _alignment = alignment;
 170   _obj_alignment = ObjectAlignmentInBytes;
 171   _compact_strings = CompactStrings;
 172   _narrow_oop_mode = Universe::narrow_oop_mode();
 173   _narrow_oop_shift = Universe::narrow_oop_shift();
 174   _max_heap_size = MaxHeapSize;
 175   _narrow_klass_base = Universe::narrow_klass_base();
 176   _narrow_klass_shift = Universe::narrow_klass_shift();
 177   _classpath_entry_table_size = mapinfo->_classpath_entry_table_size;
 178   _classpath_entry_table = mapinfo->_classpath_entry_table;
 179   _classpath_entry_size = mapinfo->_classpath_entry_size;
 180 
 181   // The following fields are for sanity checks for whether this archive
 182   // will function correctly with this JVM and the bootclasspath it's
 183   // invoked with.
 184 
 185   // JVM version string ... changes on each build.
 186   get_header_version(_jvm_ident);
 187 }
 188 
 189 void FileMapInfo::allocate_classpath_entry_table() {
 190   int bytes = 0;
 191   int count = 0;


 882   }
 883   if (_magic != (int)0xf00baba2) {
 884     FileMapInfo::fail_continue("The shared archive file has a bad magic number.");
 885     return false;
 886   }
 887   char header_version[JVM_IDENT_MAX];
 888   get_header_version(header_version);
 889   if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) {
 890     if (TraceClassPaths) {
 891       tty->print_cr("Expected: %s", header_version);
 892       tty->print_cr("Actual:   %s", _jvm_ident);
 893     }
 894     FileMapInfo::fail_continue("The shared archive file was created by a different"
 895                   " version or build of HotSpot");
 896     return false;
 897   }
 898   if (_obj_alignment != ObjectAlignmentInBytes) {
 899     FileMapInfo::fail_continue("The shared archive file's ObjectAlignmentInBytes of %d"
 900                   " does not equal the current ObjectAlignmentInBytes of " INTX_FORMAT ".",
 901                   _obj_alignment, ObjectAlignmentInBytes);
 902     return false;
 903   }
 904   if (_compact_strings != CompactStrings) {
 905     FileMapInfo::fail_continue("The shared archive file's CompactStrings setting (%s)"
 906                   " does not equal the current CompactStrings setting (%s).",
 907                   _compact_strings ? "enabled" : "disabled",
 908                   CompactStrings   ? "enabled" : "disabled");
 909     return false;
 910   }
 911 
 912   return true;
 913 }
 914 
 915 bool FileMapInfo::validate_header() {
 916   bool status = _header->validate();
 917 
 918   if (status) {
 919     if (!ClassLoader::check_shared_paths_misc_info(_paths_misc_info, _header->_paths_misc_info_size)) {
 920       if (!PrintSharedArchiveAndExit) {
 921         fail_continue("shared class paths mismatch (hint: enable -XX:+TraceClassPaths to diagnose the failure)");
 922         status = false;
 923       }
 924     }
 925   }
 926 
 927   if (_paths_misc_info != NULL) {
 928     FREE_C_HEAP_ARRAY(char, _paths_misc_info);


< prev index next >