< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page




1437   }
1438 
1439   if (key != prop) {
1440     // SystemProperty copy passed value, thus free previously allocated
1441     // memory
1442     FreeHeap((void *)key);
1443   }
1444 
1445   return true;
1446 }
1447 
1448 #if INCLUDE_CDS
1449 const char* unsupported_properties[] = { "jdk.module.limitmods",
1450                                          "jdk.module.upgrade.path",
1451                                          "jdk.module.patch.0" };
1452 const char* unsupported_options[] = { "--limit-modules",
1453                                       "--upgrade-module-path",
1454                                       "--patch-module"
1455                                     };
1456 void Arguments::check_unsupported_dumping_properties() {
1457   assert(DumpSharedSpaces || DynamicDumpSharedSpaces,
1458          "this function is only used with CDS dump time");
1459   assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
1460   // If a vm option is found in the unsupported_options array, vm will exit with an error message.
1461   SystemProperty* sp = system_properties();
1462   while (sp != NULL) {
1463     for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
1464       if (strcmp(sp->key(), unsupported_properties[i]) == 0) {
1465         vm_exit_during_initialization(
1466           "Cannot use the following option when dumping the shared archive", unsupported_options[i]);
1467       }
1468     }
1469     sp = sp->next();
1470   }
1471 
1472   // Check for an exploded module build in use with -Xshare:dump.
1473   if (!has_jimage()) {
1474     vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
1475   }
1476 }
1477 


3520   //cur_path[len] = '\0';
3521   FileMapInfo::check_archive((const char*)cur_path, false /*is_static*/);
3522   *top_archive_path = cur_path;
3523 }
3524 
3525 bool Arguments::init_shared_archive_paths() {
3526   if (ArchiveClassesAtExit != NULL) {
3527     if (DumpSharedSpaces) {
3528       vm_exit_during_initialization("-XX:ArchiveClassesAtExit cannot be used with -Xshare:dump");
3529     }
3530     if (FLAG_SET_CMDLINE(DynamicDumpSharedSpaces, true) != JVMFlag::SUCCESS) {
3531       return false;
3532     }
3533     check_unsupported_dumping_properties();
3534     SharedDynamicArchivePath = os::strdup_check_oom(ArchiveClassesAtExit, mtArguments);
3535   }
3536   if (SharedArchiveFile == NULL) {
3537     SharedArchivePath = get_default_shared_archive_path();
3538   } else {
3539     int archives = num_archives(SharedArchiveFile);
3540     if (DynamicDumpSharedSpaces || DumpSharedSpaces) {
3541       if (archives > 1) {
3542         vm_exit_during_initialization(
3543           "Cannot have more than 1 archive file specified in -XX:SharedArchiveFile during CDS dumping");
3544       }
3545       if (DynamicDumpSharedSpaces) {
3546         if (os::same_files(SharedArchiveFile, ArchiveClassesAtExit)) {
3547           vm_exit_during_initialization(
3548             "Cannot have the same archive file specified for -XX:SharedArchiveFile and -XX:ArchiveClassesAtExit",
3549             SharedArchiveFile);
3550         }
3551       }
3552     }
3553     if (!DynamicDumpSharedSpaces && !DumpSharedSpaces){
3554       if (archives > 2) {
3555         vm_exit_during_initialization(
3556           "Cannot have more than 2 archive files specified in the -XX:SharedArchiveFile option");
3557       }
3558       if (archives == 1) {
3559         char* temp_archive_path = os::strdup_check_oom(SharedArchiveFile, mtArguments);
3560         int name_size;
3561         bool success =
3562           FileMapInfo::get_base_archive_name_from_header(temp_archive_path, &name_size, &SharedArchivePath);
3563         if (!success) {
3564           SharedArchivePath = temp_archive_path;
3565         } else {
3566           SharedDynamicArchivePath = temp_archive_path;
3567         }
3568       } else {
3569         extract_shared_archive_paths((const char*)SharedArchiveFile,
3570                                       &SharedArchivePath, &SharedDynamicArchivePath);
3571       }
3572     } else { // CDS dumping
3573       SharedArchivePath = os::strdup_check_oom(SharedArchiveFile, mtArguments);




1437   }
1438 
1439   if (key != prop) {
1440     // SystemProperty copy passed value, thus free previously allocated
1441     // memory
1442     FreeHeap((void *)key);
1443   }
1444 
1445   return true;
1446 }
1447 
1448 #if INCLUDE_CDS
1449 const char* unsupported_properties[] = { "jdk.module.limitmods",
1450                                          "jdk.module.upgrade.path",
1451                                          "jdk.module.patch.0" };
1452 const char* unsupported_options[] = { "--limit-modules",
1453                                       "--upgrade-module-path",
1454                                       "--patch-module"
1455                                     };
1456 void Arguments::check_unsupported_dumping_properties() {
1457   assert(is_dumping_archive(),
1458          "this function is only used with CDS dump time");
1459   assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
1460   // If a vm option is found in the unsupported_options array, vm will exit with an error message.
1461   SystemProperty* sp = system_properties();
1462   while (sp != NULL) {
1463     for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
1464       if (strcmp(sp->key(), unsupported_properties[i]) == 0) {
1465         vm_exit_during_initialization(
1466           "Cannot use the following option when dumping the shared archive", unsupported_options[i]);
1467       }
1468     }
1469     sp = sp->next();
1470   }
1471 
1472   // Check for an exploded module build in use with -Xshare:dump.
1473   if (!has_jimage()) {
1474     vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
1475   }
1476 }
1477 


3520   //cur_path[len] = '\0';
3521   FileMapInfo::check_archive((const char*)cur_path, false /*is_static*/);
3522   *top_archive_path = cur_path;
3523 }
3524 
3525 bool Arguments::init_shared_archive_paths() {
3526   if (ArchiveClassesAtExit != NULL) {
3527     if (DumpSharedSpaces) {
3528       vm_exit_during_initialization("-XX:ArchiveClassesAtExit cannot be used with -Xshare:dump");
3529     }
3530     if (FLAG_SET_CMDLINE(DynamicDumpSharedSpaces, true) != JVMFlag::SUCCESS) {
3531       return false;
3532     }
3533     check_unsupported_dumping_properties();
3534     SharedDynamicArchivePath = os::strdup_check_oom(ArchiveClassesAtExit, mtArguments);
3535   }
3536   if (SharedArchiveFile == NULL) {
3537     SharedArchivePath = get_default_shared_archive_path();
3538   } else {
3539     int archives = num_archives(SharedArchiveFile);
3540     if (is_dumping_archive()) {
3541       if (archives > 1) {
3542         vm_exit_during_initialization(
3543           "Cannot have more than 1 archive file specified in -XX:SharedArchiveFile during CDS dumping");
3544       }
3545       if (DynamicDumpSharedSpaces) {
3546         if (os::same_files(SharedArchiveFile, ArchiveClassesAtExit)) {
3547           vm_exit_during_initialization(
3548             "Cannot have the same archive file specified for -XX:SharedArchiveFile and -XX:ArchiveClassesAtExit",
3549             SharedArchiveFile);
3550         }
3551       }
3552     }
3553     if (!is_dumping_archive()){
3554       if (archives > 2) {
3555         vm_exit_during_initialization(
3556           "Cannot have more than 2 archive files specified in the -XX:SharedArchiveFile option");
3557       }
3558       if (archives == 1) {
3559         char* temp_archive_path = os::strdup_check_oom(SharedArchiveFile, mtArguments);
3560         int name_size;
3561         bool success =
3562           FileMapInfo::get_base_archive_name_from_header(temp_archive_path, &name_size, &SharedArchivePath);
3563         if (!success) {
3564           SharedArchivePath = temp_archive_path;
3565         } else {
3566           SharedDynamicArchivePath = temp_archive_path;
3567         }
3568       } else {
3569         extract_shared_archive_paths((const char*)SharedArchiveFile,
3570                                       &SharedArchivePath, &SharedDynamicArchivePath);
3571       }
3572     } else { // CDS dumping
3573       SharedArchivePath = os::strdup_check_oom(SharedArchiveFile, mtArguments);


< prev index next >