1441
1442 if (eq == NULL) {
1443 // property doesn't have a value, thus use passed string
1444 key = prop;
1445 } else {
1446 // property have a value, thus extract it and save to the
1447 // allocated string
1448 size_t key_len = eq - prop;
1449 char* tmp_key = AllocateHeap(key_len + 1, mtArguments);
1450
1451 jio_snprintf(tmp_key, key_len + 1, "%s", prop);
1452 key = tmp_key;
1453
1454 value = &prop[key_len + 1];
1455 }
1456
1457 #if INCLUDE_CDS
1458 if (is_internal_module_property(key) ||
1459 strcmp(key, "jdk.module.main") == 0) {
1460 MetaspaceShared::disable_optimized_module_handling();
1461 log_info(cds)("Using optimized module handling disabled due to incompatible property: %s=%s", key, value);
1462 }
1463 #endif
1464
1465 if (strcmp(key, "java.compiler") == 0) {
1466 process_java_compiler_argument(value);
1467 // Record value in Arguments, but let it get passed to Java.
1468 } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0) {
1469 // sun.java.launcher.is_altjvm property is
1470 // private and is processed in process_sun_java_launcher_properties();
1471 // the sun.java.launcher property is passed on to the java application
1472 } else if (strcmp(key, "sun.boot.library.path") == 0) {
1473 // append is true, writable is true, internal is false
1474 PropertyList_unique_add(&_system_properties, key, value, AppendProperty,
1475 WriteableProperty, ExternalProperty);
1476 } else {
1477 if (strcmp(key, "sun.java.command") == 0) {
1478 char *old_java_command = _java_command;
1479 _java_command = os::strdup_check_oom(value, mtArguments);
1480 if (old_java_command != NULL) {
1481 os::free(old_java_command);
2490 if (*tail == '\0') {
2491 JavaAssertions::setUserClassDefault(enable);
2492 } else {
2493 assert(*tail == ':', "bogus match by match_option()");
2494 JavaAssertions::addOption(tail + 1, enable);
2495 }
2496 // -dsa / -esa / -disablesystemassertions / -enablesystemassertions
2497 } else if (match_option(option, system_assertion_options, &tail, false)) {
2498 bool enable = option->optionString[1] == 'e'; // char after '-' is 'e'
2499 JavaAssertions::setSystemClassDefault(enable);
2500 // -bootclasspath:
2501 } else if (match_option(option, "-Xbootclasspath:", &tail)) {
2502 jio_fprintf(defaultStream::output_stream(),
2503 "-Xbootclasspath is no longer a supported option.\n");
2504 return JNI_EINVAL;
2505 // -bootclasspath/a:
2506 } else if (match_option(option, "-Xbootclasspath/a:", &tail)) {
2507 Arguments::append_sysclasspath(tail);
2508 #if INCLUDE_CDS
2509 MetaspaceShared::disable_optimized_module_handling();
2510 log_info(cds)("Using optimized module handling disabled due to bootclasspath was appended");
2511 #endif
2512 // -bootclasspath/p:
2513 } else if (match_option(option, "-Xbootclasspath/p:", &tail)) {
2514 jio_fprintf(defaultStream::output_stream(),
2515 "-Xbootclasspath/p is no longer a supported option.\n");
2516 return JNI_EINVAL;
2517 // -Xrun
2518 } else if (match_option(option, "-Xrun", &tail)) {
2519 if (tail != NULL) {
2520 const char* pos = strchr(tail, ':');
2521 size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
2522 char* name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments);
2523 jio_snprintf(name, len + 1, "%s", tail);
2524
2525 char *options = NULL;
2526 if(pos != NULL) {
2527 size_t len2 = strlen(pos+1) + 1; // options start after ':'. Final zero must be copied.
2528 options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtArguments), pos+1, len2);
2529 }
2530 #if !INCLUDE_JVMTI
|
1441
1442 if (eq == NULL) {
1443 // property doesn't have a value, thus use passed string
1444 key = prop;
1445 } else {
1446 // property have a value, thus extract it and save to the
1447 // allocated string
1448 size_t key_len = eq - prop;
1449 char* tmp_key = AllocateHeap(key_len + 1, mtArguments);
1450
1451 jio_snprintf(tmp_key, key_len + 1, "%s", prop);
1452 key = tmp_key;
1453
1454 value = &prop[key_len + 1];
1455 }
1456
1457 #if INCLUDE_CDS
1458 if (is_internal_module_property(key) ||
1459 strcmp(key, "jdk.module.main") == 0) {
1460 MetaspaceShared::disable_optimized_module_handling();
1461 log_info(cds)("optimized module handling: disabled due to incompatible property: %s=%s", key, value);
1462 }
1463 if (strcmp(key, "jdk.module.showModuleResolution") == 0 ||
1464 strcmp(key, "jdk.module.illegalAccess") == 0 ||
1465 strcmp(key, "jdk.module.validation") == 0 ||
1466 strcmp(key, "java.system.class.loader") == 0) {
1467 MetaspaceShared::disable_full_module_graph();
1468 log_info(cds)("full module graph: disabled due to incompatible property: %s=%s", key, value);
1469 }
1470 #endif
1471
1472 if (strcmp(key, "java.compiler") == 0) {
1473 process_java_compiler_argument(value);
1474 // Record value in Arguments, but let it get passed to Java.
1475 } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0) {
1476 // sun.java.launcher.is_altjvm property is
1477 // private and is processed in process_sun_java_launcher_properties();
1478 // the sun.java.launcher property is passed on to the java application
1479 } else if (strcmp(key, "sun.boot.library.path") == 0) {
1480 // append is true, writable is true, internal is false
1481 PropertyList_unique_add(&_system_properties, key, value, AppendProperty,
1482 WriteableProperty, ExternalProperty);
1483 } else {
1484 if (strcmp(key, "sun.java.command") == 0) {
1485 char *old_java_command = _java_command;
1486 _java_command = os::strdup_check_oom(value, mtArguments);
1487 if (old_java_command != NULL) {
1488 os::free(old_java_command);
2497 if (*tail == '\0') {
2498 JavaAssertions::setUserClassDefault(enable);
2499 } else {
2500 assert(*tail == ':', "bogus match by match_option()");
2501 JavaAssertions::addOption(tail + 1, enable);
2502 }
2503 // -dsa / -esa / -disablesystemassertions / -enablesystemassertions
2504 } else if (match_option(option, system_assertion_options, &tail, false)) {
2505 bool enable = option->optionString[1] == 'e'; // char after '-' is 'e'
2506 JavaAssertions::setSystemClassDefault(enable);
2507 // -bootclasspath:
2508 } else if (match_option(option, "-Xbootclasspath:", &tail)) {
2509 jio_fprintf(defaultStream::output_stream(),
2510 "-Xbootclasspath is no longer a supported option.\n");
2511 return JNI_EINVAL;
2512 // -bootclasspath/a:
2513 } else if (match_option(option, "-Xbootclasspath/a:", &tail)) {
2514 Arguments::append_sysclasspath(tail);
2515 #if INCLUDE_CDS
2516 MetaspaceShared::disable_optimized_module_handling();
2517 log_info(cds)("optimized module handling: disabled because bootclasspath was appended");
2518 #endif
2519 // -bootclasspath/p:
2520 } else if (match_option(option, "-Xbootclasspath/p:", &tail)) {
2521 jio_fprintf(defaultStream::output_stream(),
2522 "-Xbootclasspath/p is no longer a supported option.\n");
2523 return JNI_EINVAL;
2524 // -Xrun
2525 } else if (match_option(option, "-Xrun", &tail)) {
2526 if (tail != NULL) {
2527 const char* pos = strchr(tail, ':');
2528 size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
2529 char* name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments);
2530 jio_snprintf(name, len + 1, "%s", tail);
2531
2532 char *options = NULL;
2533 if(pos != NULL) {
2534 size_t len2 = strlen(pos+1) + 1; // options start after ':'. Final zero must be copied.
2535 options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtArguments), pos+1, len2);
2536 }
2537 #if !INCLUDE_JVMTI
|