@@ -209,11 +209,15 @@ void FileMapInfo::populate_header(size_t core_region_alignment) {
209
209
// dynamic header including base archive name for non-default base archive
210
210
c_header_size = sizeof (DynamicArchiveHeader);
211
211
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 ;
214
217
header_size += base_archive_name_size;
215
218
base_archive_name_offset = c_header_size;
216
219
}
220
+ FREE_C_HEAP_ARRAY (const char , default_base_archive_name);
217
221
}
218
222
_header = (FileMapHeader*)os::malloc (header_size, mtInternal);
219
223
memset ((void *)_header, 0 , header_size);
@@ -301,7 +305,7 @@ void FileMapHeader::print(outputStream* st) {
301
305
302
306
st->print_cr (" - magic: 0x%08x" , magic ());
303
307
st->print_cr (" - crc: 0x%08x" , crc ());
304
- st->print_cr (" - version: %d " , version ());
308
+ st->print_cr (" - version: 0x%x " , version ());
305
309
st->print_cr (" - header_size: " UINT32_FORMAT, header_size ());
306
310
st->print_cr (" - base_archive_name_offset: " UINT32_FORMAT, base_archive_name_offset ());
307
311
st->print_cr (" - base_archive_name_size: " UINT32_FORMAT, base_archive_name_size ());
@@ -1151,14 +1155,14 @@ class FileHeaderHelper {
1151
1155
}
1152
1156
1153
1157
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. " ,
1155
1159
gen_header._version , CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION);
1156
1160
return false ;
1157
1161
}
1158
1162
1159
1163
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);
1162
1166
}
1163
1167
1164
1168
size_t filelen = os::lseek (fd, 0 , SEEK_END);
@@ -1332,8 +1336,8 @@ bool FileMapInfo::init_from_file(int fd) {
1332
1336
}
1333
1337
1334
1338
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 ());
1337
1341
fail_continue (" The shared archive file has the wrong version." );
1338
1342
return false ;
1339
1343
}
0 commit comments