@@ -209,11 +209,15 @@ void FileMapInfo::populate_header(size_t core_region_alignment) {
209209 // dynamic header including base archive name for non-default base archive
210210 c_header_size = sizeof (DynamicArchiveHeader);
211211 header_size = c_header_size;
212- if (!FLAG_IS_DEFAULT (SharedArchiveFile)) {
213- base_archive_name_size = strlen (Arguments::GetSharedArchivePath ()) + 1 ;
212+
213+ const char * default_base_archive_name = Arguments::get_default_shared_archive_path ();
214+ const char * current_base_archive_name = Arguments::GetSharedArchivePath ();
215+ if (!os::same_files (current_base_archive_name, default_base_archive_name)) {
216+ base_archive_name_size = strlen (current_base_archive_name) + 1 ;
214217 header_size += base_archive_name_size;
215218 base_archive_name_offset = c_header_size;
216219 }
220+ FREE_C_HEAP_ARRAY (const char , default_base_archive_name);
217221 }
218222 _header = (FileMapHeader*)os::malloc (header_size, mtInternal);
219223 memset ((void *)_header, 0 , header_size);
@@ -301,7 +305,7 @@ void FileMapHeader::print(outputStream* st) {
301305
302306 st->print_cr (" - magic: 0x%08x" , magic ());
303307 st->print_cr (" - crc: 0x%08x" , crc ());
304- st->print_cr (" - version: %d " , version ());
308+ st->print_cr (" - version: 0x%x " , version ());
305309 st->print_cr (" - header_size: " UINT32_FORMAT, header_size ());
306310 st->print_cr (" - base_archive_name_offset: " UINT32_FORMAT, base_archive_name_offset ());
307311 st->print_cr (" - base_archive_name_size: " UINT32_FORMAT, base_archive_name_size ());
@@ -1151,14 +1155,14 @@ class FileHeaderHelper {
11511155 }
11521156
11531157 if (gen_header._version < CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION) {
1154- FileMapInfo::fail_continue (" Cannot handle shared archive file version %d . Must be at least %d " ,
1158+ FileMapInfo::fail_continue (" Cannot handle shared archive file version 0x%x . Must be at least 0x%x. " ,
11551159 gen_header._version , CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION);
11561160 return false ;
11571161 }
11581162
11591163 if (gen_header._version != CURRENT_CDS_ARCHIVE_VERSION) {
1160- FileMapInfo::fail_continue (" The shared archive file version %d does not match the required version %d " ,
1161- gen_header._version , CURRENT_CDS_ARCHIVE_VERSION);
1164+ FileMapInfo::fail_continue (" The shared archive file version 0x%x does not match the required version 0x%x. " ,
1165+ gen_header._version , CURRENT_CDS_ARCHIVE_VERSION);
11621166 }
11631167
11641168 size_t filelen = os::lseek (fd, 0 , SEEK_END);
@@ -1332,8 +1336,8 @@ bool FileMapInfo::init_from_file(int fd) {
13321336 }
13331337
13341338 if (header ()->version () != CURRENT_CDS_ARCHIVE_VERSION) {
1335- log_info (cds)(" _version expected: %d " , CURRENT_CDS_ARCHIVE_VERSION);
1336- log_info (cds)(" actual: %d " , header ()->version ());
1339+ log_info (cds)(" _version expected: 0x%x " , CURRENT_CDS_ARCHIVE_VERSION);
1340+ log_info (cds)(" actual: 0x%x " , header ()->version ());
13371341 fail_continue (" The shared archive file has the wrong version." );
13381342 return false ;
13391343 }
0 commit comments