261 set_name(path, THREAD); |
261 set_name(path, THREAD); |
262 } |
262 } |
263 |
263 |
264 void SharedClassPathEntry::init(bool is_modules_image, |
264 void SharedClassPathEntry::init(bool is_modules_image, |
265 ClassPathEntry* cpe, TRAPS) { |
265 ClassPathEntry* cpe, TRAPS) { |
266 assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only"); |
266 Arguments::assert_is_dumping_archive(); |
267 _timestamp = 0; |
267 _timestamp = 0; |
268 _filesize = 0; |
268 _filesize = 0; |
269 _from_class_path_attr = false; |
269 _from_class_path_attr = false; |
270 |
270 |
271 struct stat st; |
271 struct stat st; |
395 _table = MetadataFactory::new_array<u8>(loader_data, (int)(bytes + 7 / 8), THREAD); |
395 _table = MetadataFactory::new_array<u8>(loader_data, (int)(bytes + 7 / 8), THREAD); |
396 _size = num_entries; |
396 _size = num_entries; |
397 } |
397 } |
398 |
398 |
399 void FileMapInfo::allocate_shared_path_table() { |
399 void FileMapInfo::allocate_shared_path_table() { |
400 assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "Sanity"); |
400 Arguments::assert_is_dumping_archive(); |
401 |
401 |
402 EXCEPTION_MARK; // The following calls should never throw, but would exit VM on error. |
402 EXCEPTION_MARK; // The following calls should never throw, but would exit VM on error. |
403 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); |
403 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); |
404 ClassPathEntry* jrt = ClassLoader::get_jrt_entry(); |
404 ClassPathEntry* jrt = ClassLoader::get_jrt_entry(); |
405 |
405 |
442 |
442 |
443 return i; |
443 return i; |
444 } |
444 } |
445 |
445 |
446 void FileMapInfo::check_nonempty_dir_in_shared_path_table() { |
446 void FileMapInfo::check_nonempty_dir_in_shared_path_table() { |
447 assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only"); |
447 Arguments::assert_is_dumping_archive(); |
448 |
448 |
449 bool has_nonempty_dir = false; |
449 bool has_nonempty_dir = false; |
450 |
450 |
451 int last = _shared_path_table.size() - 1; |
451 int last = _shared_path_table.size() - 1; |
452 if (last > ClassLoaderExt::max_used_path_index()) { |
452 if (last > ClassLoaderExt::max_used_path_index()) { |
469 ClassLoader::exit_with_path_failure("Cannot have non-empty directory in paths", NULL); |
469 ClassLoader::exit_with_path_failure("Cannot have non-empty directory in paths", NULL); |
470 } |
470 } |
471 } |
471 } |
472 |
472 |
473 void FileMapInfo::record_non_existent_class_path_entry(const char* path) { |
473 void FileMapInfo::record_non_existent_class_path_entry(const char* path) { |
474 assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only"); |
474 Arguments::assert_is_dumping_archive(); |
475 log_info(class, path)("non-existent Class-Path entry %s", path); |
475 log_info(class, path)("non-existent Class-Path entry %s", path); |
476 if (_non_existent_class_paths == NULL) { |
476 if (_non_existent_class_paths == NULL) { |
477 _non_existent_class_paths = new (ResourceObj::C_HEAP, mtInternal)GrowableArray<const char*>(10, true); |
477 _non_existent_class_paths = new (ResourceObj::C_HEAP, mtInternal)GrowableArray<const char*>(10, true); |
478 } |
478 } |
479 _non_existent_class_paths->append(os::strdup(path)); |
479 _non_existent_class_paths->append(os::strdup(path)); |
480 } |
480 } |
481 |
481 |
482 int FileMapInfo::num_non_existent_class_paths() { |
482 int FileMapInfo::num_non_existent_class_paths() { |
483 assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only"); |
483 Arguments::assert_is_dumping_archive(); |
484 if (_non_existent_class_paths != NULL) { |
484 if (_non_existent_class_paths != NULL) { |
485 return _non_existent_class_paths->length(); |
485 return _non_existent_class_paths->length(); |
486 } else { |
486 } else { |
487 return 0; |
487 return 0; |
488 } |
488 } |
1148 _crc = crc; |
1148 _crc = crc; |
1149 } |
1149 } |
1150 |
1150 |
1151 void FileMapInfo::write_region(int region, char* base, size_t size, |
1151 void FileMapInfo::write_region(int region, char* base, size_t size, |
1152 bool read_only, bool allow_exec) { |
1152 bool read_only, bool allow_exec) { |
1153 assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "Dump time only"); |
1153 Arguments::assert_is_dumping_archive(); |
1154 |
1154 |
1155 FileMapRegion* si = space_at(region); |
1155 FileMapRegion* si = space_at(region); |
1156 char* target_base = base; |
1156 char* target_base = base; |
1157 if (DynamicDumpSharedSpaces) { |
1157 if (DynamicDumpSharedSpaces) { |
1158 assert(!HeapShared::is_heap_region(region), "dynamic archive doesn't support heap regions"); |
1158 assert(!HeapShared::is_heap_region(region), "dynamic archive doesn't support heap regions"); |