src/hotspot/share/memory/filemap.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff src/hotspot/share/memory

src/hotspot/share/memory/filemap.cpp

Print this page




 316     EXCEPTION_MARK;
 317     SharedClassUtil::update_shared_classpath(acpe, ent, THREAD);
 318     acpe = acpe->next();
 319     i++;
 320   }
 321 
 322   // 3. module path
 323   ClassPathEntry *mpe = ClassLoader::module_path_entries();
 324   while (mpe != NULL) {
 325     log_info(class, path)("add module path %s",mpe->name());
 326     SharedClassPathEntry* ent = shared_path(i);
 327     ent->init(mpe->name(), THREAD);
 328     EXCEPTION_MARK;
 329     SharedClassUtil::update_shared_classpath(mpe, ent, THREAD);
 330     mpe = mpe->next();
 331     i++;
 332   }
 333   assert(i == num_entries, "number of shared path entry mismatch");
 334 }
 335 














 336 void FileMapInfo::check_nonempty_dir_in_shared_path_table() {
 337   assert(DumpSharedSpaces, "dump time only");
 338 
 339   bool has_nonempty_dir = false;
 340 
 341   int end = _shared_path_table_size;
 342   if (!ClassLoaderExt::has_platform_or_app_classes()) {
 343     // only check the boot path if no app class is loaded
 344     end = ClassLoaderExt::app_class_paths_start_index();
 345   }
 346 
 347   for (int i = 0; i < end; i++) {
 348     SharedClassPathEntry *e = shared_path(i);
 349     if (e->is_dir()) {
 350       const char* path = e->name();
 351       if (!os::dir_is_empty(path)) {
 352         tty->print_cr("Error: non-empty directory '%s'", path);
 353         has_nonempty_dir = true;
 354       }






 355     }
 356   }
 357 
 358   if (has_nonempty_dir) {
 359     ClassLoader::exit_with_path_failure("Cannot have non-empty directory in paths", NULL);
 360   }
 361 }
 362 
 363 bool FileMapInfo::validate_shared_path_table() {
 364   assert(UseSharedSpaces, "runtime only");
 365 
 366   _validating_shared_path_table = true;
 367   _shared_path_table = _header->_shared_path_table;
 368   _shared_path_entry_size = _header->_shared_path_entry_size;
 369   _shared_path_table_size = _header->_shared_path_table_size;
 370 
 371   FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header();
 372   int module_paths_start_index = header->_app_module_paths_start_index;
 373 
 374   // If the shared archive contain app or platform classes, validate all entries




 316     EXCEPTION_MARK;
 317     SharedClassUtil::update_shared_classpath(acpe, ent, THREAD);
 318     acpe = acpe->next();
 319     i++;
 320   }
 321 
 322   // 3. module path
 323   ClassPathEntry *mpe = ClassLoader::module_path_entries();
 324   while (mpe != NULL) {
 325     log_info(class, path)("add module path %s",mpe->name());
 326     SharedClassPathEntry* ent = shared_path(i);
 327     ent->init(mpe->name(), THREAD);
 328     EXCEPTION_MARK;
 329     SharedClassUtil::update_shared_classpath(mpe, ent, THREAD);
 330     mpe = mpe->next();
 331     i++;
 332   }
 333   assert(i == num_entries, "number of shared path entry mismatch");
 334 }
 335 
 336 static bool check_nonempty_dir(SharedClassPathEntry* e) {
 337   if (!e->is_dir()) {
 338     return false;
 339   }
 340 
 341   const char* path = e->name();
 342   if (!os::dir_is_empty(path)) {
 343     tty->print_cr("Error: non-empty directory '%s'", path);
 344     return true;
 345   } else {
 346     return false;
 347   }
 348 }
 349 
 350 void FileMapInfo::check_nonempty_dir_in_shared_path_table() {
 351   assert(DumpSharedSpaces, "dump time only");
 352 
 353   bool has_nonempty_dir = false;
 354 
 355   int end = _shared_path_table_size;
 356   if (!ClassLoaderExt::has_platform_or_app_classes()) {
 357     // only check the boot path if no app class is loaded
 358     end = ClassLoaderExt::app_class_paths_start_index();
 359   }
 360 
 361   for (int i = 0; i < end; i++) {
 362     SharedClassPathEntry* e = shared_path(i);
 363     has_nonempty_dir = check_nonempty_dir(e);




 364   }
 365 
 366   // may need to check module path entries.
 367   if ((end == ClassLoaderExt::app_class_paths_start_index()) && (ClassLoader::num_module_path_entries() > 0)) {
 368     for (int i = ClassLoaderExt::app_module_paths_start_index(); i < _shared_path_table_size; i++) {
 369       SharedClassPathEntry* e = shared_path(i);
 370       has_nonempty_dir = check_nonempty_dir(e);
 371     }
 372   }
 373 
 374   if (has_nonempty_dir) {
 375     ClassLoader::exit_with_path_failure("Cannot have non-empty directory in paths", NULL);
 376   }
 377 }
 378 
 379 bool FileMapInfo::validate_shared_path_table() {
 380   assert(UseSharedSpaces, "runtime only");
 381 
 382   _validating_shared_path_table = true;
 383   _shared_path_table = _header->_shared_path_table;
 384   _shared_path_entry_size = _header->_shared_path_entry_size;
 385   _shared_path_table_size = _header->_shared_path_table_size;
 386 
 387   FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header();
 388   int module_paths_start_index = header->_app_module_paths_start_index;
 389 
 390   // If the shared archive contain app or platform classes, validate all entries


src/hotspot/share/memory/filemap.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File