src/share/vm/memory/metaspaceShared.cpp

Print this page
rev 6951 : 8066670: PrintSharedArchiveAndExit does not exit the VM when the archive is invalid
Summary: in FileMapInfo::fail_continue do not set UseSharedSpaces = false
Reviewed-by: dholmes, ccheung


 950        mapinfo->verify_region_checksum(md) &&
 951       (_mc_base = mapinfo->map_region(mc)) != NULL &&
 952        mapinfo->verify_region_checksum(mc) &&
 953       (image_alignment == (size_t)max_alignment()) &&
 954       mapinfo->validate_classpath_entry_table()) {
 955     // Success (no need to do anything)
 956     return true;
 957   } else {
 958     // If there was a failure in mapping any of the spaces, unmap the ones
 959     // that succeeded
 960     if (_ro_base != NULL) mapinfo->unmap_region(ro);
 961     if (_rw_base != NULL) mapinfo->unmap_region(rw);
 962     if (_md_base != NULL) mapinfo->unmap_region(md);
 963     if (_mc_base != NULL) mapinfo->unmap_region(mc);
 964 #ifndef _WINDOWS
 965     // Release the entire mapped region
 966     shared_rs.release();
 967 #endif
 968     // If -Xshare:on is specified, print out the error message and exit VM,
 969     // otherwise, set UseSharedSpaces to false and continue.
 970     if (RequireSharedSpaces) {
 971       vm_exit_during_initialization("Unable to use shared archive.", "Failed map_region for using -Xshare:on.");
 972     } else {
 973       FLAG_SET_DEFAULT(UseSharedSpaces, false);
 974     }
 975     return false;
 976   }
 977 }
 978 
 979 // Read the miscellaneous data from the shared file, and
 980 // serialize it out to its various destinations.
 981 
 982 void MetaspaceShared::initialize_shared_spaces() {
 983   FileMapInfo *mapinfo = FileMapInfo::current_info();
 984 
 985   char* buffer = mapinfo->region_base(md);
 986 
 987   // Skip over (reserve space for) a list of addresses of C++ vtables
 988   // for Klass objects.  They get filled in later.
 989 
 990   void** vtbl_list = (void**)buffer;




 950        mapinfo->verify_region_checksum(md) &&
 951       (_mc_base = mapinfo->map_region(mc)) != NULL &&
 952        mapinfo->verify_region_checksum(mc) &&
 953       (image_alignment == (size_t)max_alignment()) &&
 954       mapinfo->validate_classpath_entry_table()) {
 955     // Success (no need to do anything)
 956     return true;
 957   } else {
 958     // If there was a failure in mapping any of the spaces, unmap the ones
 959     // that succeeded
 960     if (_ro_base != NULL) mapinfo->unmap_region(ro);
 961     if (_rw_base != NULL) mapinfo->unmap_region(rw);
 962     if (_md_base != NULL) mapinfo->unmap_region(md);
 963     if (_mc_base != NULL) mapinfo->unmap_region(mc);
 964 #ifndef _WINDOWS
 965     // Release the entire mapped region
 966     shared_rs.release();
 967 #endif
 968     // If -Xshare:on is specified, print out the error message and exit VM,
 969     // otherwise, set UseSharedSpaces to false and continue.
 970     if (RequireSharedSpaces || PrintSharedArchiveAndExit) {
 971       vm_exit_during_initialization("Unable to use shared archive.", "Failed map_region for using -Xshare:on.");
 972     } else {
 973       FLAG_SET_DEFAULT(UseSharedSpaces, false);
 974     }
 975     return false;
 976   }
 977 }
 978 
 979 // Read the miscellaneous data from the shared file, and
 980 // serialize it out to its various destinations.
 981 
 982 void MetaspaceShared::initialize_shared_spaces() {
 983   FileMapInfo *mapinfo = FileMapInfo::current_info();
 984 
 985   char* buffer = mapinfo->region_base(md);
 986 
 987   // Skip over (reserve space for) a list of addresses of C++ vtables
 988   // for Klass objects.  They get filled in later.
 989 
 990   void** vtbl_list = (void**)buffer;