< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page




1450 bool Arguments::add_property(const char* prop, PropertyWriteable writeable, PropertyInternal internal) {
1451   const char* eq = strchr(prop, '=');
1452   const char* key;
1453   const char* value = "";
1454 
1455   if (eq == NULL) {
1456     // property doesn't have a value, thus use passed string
1457     key = prop;
1458   } else {
1459     // property have a value, thus extract it and save to the
1460     // allocated string
1461     size_t key_len = eq - prop;
1462     char* tmp_key = AllocateHeap(key_len + 1, mtArguments);
1463 
1464     jio_snprintf(tmp_key, key_len + 1, "%s", prop);
1465     key = tmp_key;
1466 
1467     value = &prop[key_len + 1];
1468   }
1469 






1470   if (strcmp(key, "java.compiler") == 0) {
1471     process_java_compiler_argument(value);
1472     // Record value in Arguments, but let it get passed to Java.
1473   } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0) {
1474     // sun.java.launcher.is_altjvm property is
1475     // private and is processed in process_sun_java_launcher_properties();
1476     // the sun.java.launcher property is passed on to the java application
1477   } else if (strcmp(key, "sun.boot.library.path") == 0) {
1478     // append is true, writable is true, internal is false
1479     PropertyList_unique_add(&_system_properties, key, value, AppendProperty,
1480                             WriteableProperty, ExternalProperty);
1481   } else {
1482     if (strcmp(key, "sun.java.command") == 0) {
1483       char *old_java_command = _java_command;
1484       _java_command = os::strdup_check_oom(value, mtArguments);
1485       if (old_java_command != NULL) {
1486         os::free(old_java_command);
1487       }
1488     } else if (strcmp(key, "java.vendor.url.bug") == 0) {
1489       // If this property is set on the command line then its value will be


2493     } else if (match_option(option, user_assertion_options, &tail, true)) {
2494       bool enable = option->optionString[1] == 'e';     // char after '-' is 'e'
2495       if (*tail == '\0') {
2496         JavaAssertions::setUserClassDefault(enable);
2497       } else {
2498         assert(*tail == ':', "bogus match by match_option()");
2499         JavaAssertions::addOption(tail + 1, enable);
2500       }
2501     // -dsa / -esa / -disablesystemassertions / -enablesystemassertions
2502     } else if (match_option(option, system_assertion_options, &tail, false)) {
2503       bool enable = option->optionString[1] == 'e';     // char after '-' is 'e'
2504       JavaAssertions::setSystemClassDefault(enable);
2505     // -bootclasspath:
2506     } else if (match_option(option, "-Xbootclasspath:", &tail)) {
2507         jio_fprintf(defaultStream::output_stream(),
2508           "-Xbootclasspath is no longer a supported option.\n");
2509         return JNI_EINVAL;
2510     // -bootclasspath/a:
2511     } else if (match_option(option, "-Xbootclasspath/a:", &tail)) {
2512       Arguments::append_sysclasspath(tail);


2513     // -bootclasspath/p:
2514     } else if (match_option(option, "-Xbootclasspath/p:", &tail)) {
2515         jio_fprintf(defaultStream::output_stream(),
2516           "-Xbootclasspath/p is no longer a supported option.\n");
2517         return JNI_EINVAL;
2518     // -Xrun
2519     } else if (match_option(option, "-Xrun", &tail)) {
2520       if (tail != NULL) {
2521         const char* pos = strchr(tail, ':');
2522         size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
2523         char* name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments);
2524         jio_snprintf(name, len + 1, "%s", tail);
2525 
2526         char *options = NULL;
2527         if(pos != NULL) {
2528           size_t len2 = strlen(pos+1) + 1; // options start after ':'.  Final zero must be copied.
2529           options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtArguments), pos+1, len2);
2530         }
2531 #if !INCLUDE_JVMTI
2532         if (strcmp(name, "jdwp") == 0) {




1450 bool Arguments::add_property(const char* prop, PropertyWriteable writeable, PropertyInternal internal) {
1451   const char* eq = strchr(prop, '=');
1452   const char* key;
1453   const char* value = "";
1454 
1455   if (eq == NULL) {
1456     // property doesn't have a value, thus use passed string
1457     key = prop;
1458   } else {
1459     // property have a value, thus extract it and save to the
1460     // allocated string
1461     size_t key_len = eq - prop;
1462     char* tmp_key = AllocateHeap(key_len + 1, mtArguments);
1463 
1464     jio_snprintf(tmp_key, key_len + 1, "%s", prop);
1465     key = tmp_key;
1466 
1467     value = &prop[key_len + 1];
1468   }
1469 
1470   if (is_internal_module_property(key) ||
1471       strcmp(key, "jdk.module.main") == 0) {
1472     MetaspaceShared::disable_optimized_module_handling();
1473     log_info(cds)("Using optimized module handling disabled due to incompatible property: %s=%s", key, value);
1474   }
1475 
1476   if (strcmp(key, "java.compiler") == 0) {
1477     process_java_compiler_argument(value);
1478     // Record value in Arguments, but let it get passed to Java.
1479   } else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0) {
1480     // sun.java.launcher.is_altjvm property is
1481     // private and is processed in process_sun_java_launcher_properties();
1482     // the sun.java.launcher property is passed on to the java application
1483   } else if (strcmp(key, "sun.boot.library.path") == 0) {
1484     // append is true, writable is true, internal is false
1485     PropertyList_unique_add(&_system_properties, key, value, AppendProperty,
1486                             WriteableProperty, ExternalProperty);
1487   } else {
1488     if (strcmp(key, "sun.java.command") == 0) {
1489       char *old_java_command = _java_command;
1490       _java_command = os::strdup_check_oom(value, mtArguments);
1491       if (old_java_command != NULL) {
1492         os::free(old_java_command);
1493       }
1494     } else if (strcmp(key, "java.vendor.url.bug") == 0) {
1495       // If this property is set on the command line then its value will be


2499     } else if (match_option(option, user_assertion_options, &tail, true)) {
2500       bool enable = option->optionString[1] == 'e';     // char after '-' is 'e'
2501       if (*tail == '\0') {
2502         JavaAssertions::setUserClassDefault(enable);
2503       } else {
2504         assert(*tail == ':', "bogus match by match_option()");
2505         JavaAssertions::addOption(tail + 1, enable);
2506       }
2507     // -dsa / -esa / -disablesystemassertions / -enablesystemassertions
2508     } else if (match_option(option, system_assertion_options, &tail, false)) {
2509       bool enable = option->optionString[1] == 'e';     // char after '-' is 'e'
2510       JavaAssertions::setSystemClassDefault(enable);
2511     // -bootclasspath:
2512     } else if (match_option(option, "-Xbootclasspath:", &tail)) {
2513         jio_fprintf(defaultStream::output_stream(),
2514           "-Xbootclasspath is no longer a supported option.\n");
2515         return JNI_EINVAL;
2516     // -bootclasspath/a:
2517     } else if (match_option(option, "-Xbootclasspath/a:", &tail)) {
2518       Arguments::append_sysclasspath(tail);
2519       MetaspaceShared::disable_optimized_module_handling();
2520       log_info(cds)("Using optimized module handling disabled due to bootclasspath was appended");
2521     // -bootclasspath/p:
2522     } else if (match_option(option, "-Xbootclasspath/p:", &tail)) {
2523         jio_fprintf(defaultStream::output_stream(),
2524           "-Xbootclasspath/p is no longer a supported option.\n");
2525         return JNI_EINVAL;
2526     // -Xrun
2527     } else if (match_option(option, "-Xrun", &tail)) {
2528       if (tail != NULL) {
2529         const char* pos = strchr(tail, ':');
2530         size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
2531         char* name = NEW_C_HEAP_ARRAY(char, len + 1, mtArguments);
2532         jio_snprintf(name, len + 1, "%s", tail);
2533 
2534         char *options = NULL;
2535         if(pos != NULL) {
2536           size_t len2 = strlen(pos+1) + 1; // options start after ':'.  Final zero must be copied.
2537           options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtArguments), pos+1, len2);
2538         }
2539 #if !INCLUDE_JVMTI
2540         if (strcmp(name, "jdwp") == 0) {


< prev index next >