1429 if (old_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) {
1430 assert(old_java_vendor_url_bug != NULL, "_java_vendor_url_bug is NULL");
1431 os::free((void *)old_java_vendor_url_bug);
1432 }
1433 }
1434
1435 // Create new property and add at the end of the list
1436 PropertyList_unique_add(&_system_properties, key, value, AddProperty, writeable, internal);
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 void Arguments::check_unsupported_dumping_properties() {
1450 assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
1451 const char* unsupported_properties[] = { "jdk.module.main",
1452 "jdk.module.limitmods",
1453 "jdk.module.path",
1454 "jdk.module.upgrade.path",
1455 "jdk.module.patch.0" };
1456 const char* unsupported_options[] = { "-m", // cannot use at dump time
1457 "--limit-modules", // ignored at dump time
1458 "--module-path", // ignored at dump time
1459 "--upgrade-module-path", // ignored at dump time
1460 "--patch-module" // ignored at dump time
1461 };
1462 assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
1463 // If a vm option is found in the unsupported_options array with index less than the info_idx,
1464 // vm will exit with an error message. Otherwise, it will print an informational message if
1465 // -Xlog:cds is enabled.
1466 uint info_idx = 1;
1467 SystemProperty* sp = system_properties();
1468 while (sp != NULL) {
1469 for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
1470 if (strcmp(sp->key(), unsupported_properties[i]) == 0) {
1471 if (i < info_idx) {
1472 vm_exit_during_initialization(
1473 "Cannot use the following option when dumping the shared archive", unsupported_options[i]);
1474 } else {
1475 log_info(cds)("Info: the %s option is ignored when dumping the shared archive",
1476 unsupported_options[i]);
1477 }
1478 }
1479 }
1480 sp = sp->next();
1481 }
1482
1483 // Check for an exploded module build in use with -Xshare:dump.
1484 if (!has_jimage()) {
1485 vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
1486 }
1487 }
1488 #endif
1489
1490 //===========================================================================================================
1491 // Setting int/mixed/comp mode flags
1492
1493 void Arguments::set_mode_flags(Mode mode) {
1494 // Set up default values for all flags.
1495 // If you add a flag to any of the branches below,
1496 // add a default value for it here.
1497 set_java_compiler(false);
1498 _mode = mode;
1499
1500 // Ensure Agent_OnLoad has the correct initial values.
1501 // This may not be the final mode; mode may change later in onload phase.
1502 PropertyList_unique_add(&_system_properties, "java.vm.info",
1503 VM_Version::vm_info_string(), AddProperty, UnwriteableProperty, ExternalProperty);
1504
1505 UseInterpreter = true;
1506 UseCompiler = true;
1507 UseLoopCounter = true;
3392 #endif
3393
3394 if (!check_vm_args_consistency()) {
3395 return JNI_ERR;
3396 }
3397
3398 #if INCLUDE_JVMCI
3399 if (UseJVMCICompiler) {
3400 Compilation_mode = CompMode_server;
3401 }
3402 #endif
3403
3404 #if INCLUDE_CDS
3405 if (DumpSharedSpaces) {
3406 // Disable biased locking now as it interferes with the clean up of
3407 // the archived Klasses and Java string objects (at dump time only).
3408 UseBiasedLocking = false;
3409 }
3410 if (UseSharedSpaces && patch_mod_javabase) {
3411 no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3412 }
3413 #endif
3414
3415 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3416 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3417 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3418
3419 return JNI_OK;
3420 }
3421
3422 // Helper class for controlling the lifetime of JavaVMInitArgs
3423 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3424 // deleted on the destruction of the ScopedVMInitArgs object.
3425 class ScopedVMInitArgs : public StackObj {
3426 private:
3427 JavaVMInitArgs _args;
3428 char* _container_name;
3429 bool _is_set;
3430 char* _vm_options_file_arg;
3431
|
1429 if (old_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) {
1430 assert(old_java_vendor_url_bug != NULL, "_java_vendor_url_bug is NULL");
1431 os::free((void *)old_java_vendor_url_bug);
1432 }
1433 }
1434
1435 // Create new property and add at the end of the list
1436 PropertyList_unique_add(&_system_properties, key, value, AddProperty, writeable, internal);
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, "this function is only used with -Xshare:dump");
1458 assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
1459 // If a vm option is found in the unsupported_options array, vm will exit with an error message.
1460 SystemProperty* sp = system_properties();
1461 while (sp != NULL) {
1462 for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
1463 if (strcmp(sp->key(), unsupported_properties[i]) == 0) {
1464 vm_exit_during_initialization(
1465 "Cannot use the following option when dumping the shared archive", unsupported_options[i]);
1466 }
1467 }
1468 sp = sp->next();
1469 }
1470
1471 // Check for an exploded module build in use with -Xshare:dump.
1472 if (!has_jimage()) {
1473 vm_exit_during_initialization("Dumping the shared archive is not supported with an exploded module build");
1474 }
1475 }
1476
1477 bool Arguments::check_unsupported_cds_runtime_properties() {
1478 assert(UseSharedSpaces, "this function is only used with -Xshare:{on,auto}");
1479 assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
1480 for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
1481 if (get_property(unsupported_properties[i]) != NULL) {
1482 if (RequireSharedSpaces) {
1483 warning("CDS is disabled when the %s option is specified.", unsupported_options[i]);
1484 }
1485 return true;
1486 }
1487 }
1488 return false;
1489 }
1490 #endif
1491
1492 //===========================================================================================================
1493 // Setting int/mixed/comp mode flags
1494
1495 void Arguments::set_mode_flags(Mode mode) {
1496 // Set up default values for all flags.
1497 // If you add a flag to any of the branches below,
1498 // add a default value for it here.
1499 set_java_compiler(false);
1500 _mode = mode;
1501
1502 // Ensure Agent_OnLoad has the correct initial values.
1503 // This may not be the final mode; mode may change later in onload phase.
1504 PropertyList_unique_add(&_system_properties, "java.vm.info",
1505 VM_Version::vm_info_string(), AddProperty, UnwriteableProperty, ExternalProperty);
1506
1507 UseInterpreter = true;
1508 UseCompiler = true;
1509 UseLoopCounter = true;
3394 #endif
3395
3396 if (!check_vm_args_consistency()) {
3397 return JNI_ERR;
3398 }
3399
3400 #if INCLUDE_JVMCI
3401 if (UseJVMCICompiler) {
3402 Compilation_mode = CompMode_server;
3403 }
3404 #endif
3405
3406 #if INCLUDE_CDS
3407 if (DumpSharedSpaces) {
3408 // Disable biased locking now as it interferes with the clean up of
3409 // the archived Klasses and Java string objects (at dump time only).
3410 UseBiasedLocking = false;
3411 }
3412 if (UseSharedSpaces && patch_mod_javabase) {
3413 no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3414 }
3415 if (UseSharedSpaces && !DumpSharedSpaces && check_unsupported_cds_runtime_properties()) {
3416 FLAG_SET_DEFAULT(UseSharedSpaces, false);
3417 }
3418 #endif
3419
3420 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3421 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3422 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3423
3424 return JNI_OK;
3425 }
3426
3427 // Helper class for controlling the lifetime of JavaVMInitArgs
3428 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3429 // deleted on the destruction of the ScopedVMInitArgs object.
3430 class ScopedVMInitArgs : public StackObj {
3431 private:
3432 JavaVMInitArgs _args;
3433 char* _container_name;
3434 bool _is_set;
3435 char* _vm_options_file_arg;
3436
|