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;
3360 #endif
3361
3362 if (!check_vm_args_consistency()) {
3363 return JNI_ERR;
3364 }
3365
3366 #if INCLUDE_JVMCI
3367 if (UseJVMCICompiler) {
3368 Compilation_mode = CompMode_server;
3369 }
3370 #endif
3371
3372 #if INCLUDE_CDS
3373 if (DumpSharedSpaces) {
3374 // Disable biased locking now as it interferes with the clean up of
3375 // the archived Klasses and Java string objects (at dump time only).
3376 UseBiasedLocking = false;
3377 }
3378 if (UseSharedSpaces && patch_mod_javabase) {
3379 no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3380 }
3381 #endif
3382
3383 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3384 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3385 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3386
3387 return JNI_OK;
3388 }
3389
3390 // Helper class for controlling the lifetime of JavaVMInitArgs
3391 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3392 // deleted on the destruction of the ScopedVMInitArgs object.
3393 class ScopedVMInitArgs : public StackObj {
3394 private:
3395 JavaVMInitArgs _args;
3396 char* _container_name;
3397 bool _is_set;
3398 char* _vm_options_file_arg;
3399
|
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;
3362 #endif
3363
3364 if (!check_vm_args_consistency()) {
3365 return JNI_ERR;
3366 }
3367
3368 #if INCLUDE_JVMCI
3369 if (UseJVMCICompiler) {
3370 Compilation_mode = CompMode_server;
3371 }
3372 #endif
3373
3374 #if INCLUDE_CDS
3375 if (DumpSharedSpaces) {
3376 // Disable biased locking now as it interferes with the clean up of
3377 // the archived Klasses and Java string objects (at dump time only).
3378 UseBiasedLocking = false;
3379 }
3380 if (UseSharedSpaces && patch_mod_javabase) {
3381 no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
3382 }
3383 if (UseSharedSpaces && !DumpSharedSpaces && check_unsupported_cds_runtime_properties()) {
3384 FLAG_SET_DEFAULT(UseSharedSpaces, false);
3385 }
3386 #endif
3387
3388 #ifndef CAN_SHOW_REGISTERS_ON_ASSERT
3389 UNSUPPORTED_OPTION(ShowRegistersOnAssert);
3390 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
3391
3392 return JNI_OK;
3393 }
3394
3395 // Helper class for controlling the lifetime of JavaVMInitArgs
3396 // objects. The contents of the JavaVMInitArgs are guaranteed to be
3397 // deleted on the destruction of the ScopedVMInitArgs object.
3398 class ScopedVMInitArgs : public StackObj {
3399 private:
3400 JavaVMInitArgs _args;
3401 char* _container_name;
3402 bool _is_set;
3403 char* _vm_options_file_arg;
3404
|