384 }; 385 386 // Flags that are aliases for other flags. 387 typedef struct { 388 const char* alias_name; 389 const char* real_name; 390 } AliasedFlag; 391 392 static AliasedFlag const aliased_jvm_flags[] = { 393 { "DefaultMaxRAMFraction", "MaxRAMFraction" }, 394 { "CMSMarkStackSizeMax", "MarkStackSizeMax" }, 395 { "CMSMarkStackSize", "MarkStackSize" }, 396 { "G1MarkStackSize", "MarkStackSize" }, 397 { "ParallelMarkingThreads", "ConcGCThreads" }, 398 { "ParallelCMSThreads", "ConcGCThreads" }, 399 { "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" }, 400 { NULL, NULL} 401 }; 402 403 static AliasedLoggingFlag const aliased_logging_flags[] = { 404 { "TraceClassResolution", LogLevel::Info, true, LogTag::_classresolve }, 405 { "TraceExceptions", LogLevel::Info, true, LogTag::_exceptions }, 406 { "TraceMonitorInflation", LogLevel::Debug, true, LogTag::_monitorinflation }, 407 { NULL, LogLevel::Off, false, LogTag::__NO_TAG } 408 }; 409 410 // Return true if "v" is less than "other", where "other" may be "undefined". 411 static bool version_less_than(JDK_Version v, JDK_Version other) { 412 assert(!v.is_undefined(), "must be defined"); 413 if (!other.is_undefined() && v.compare(other) >= 0) { 414 return false; 415 } else { 416 return true; 417 } 418 } 419 420 static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) { 421 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) { 422 if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) { 423 flag = special_jvm_flags[i]; 2635 for (int index = 0; index < args->nOptions; index++) { 2636 bool is_absolute_path = false; // for -agentpath vs -agentlib 2637 2638 const JavaVMOption* option = args->options + index; 2639 2640 if (!match_option(option, "-Djava.class.path", &tail) && 2641 !match_option(option, "-Dsun.java.command", &tail) && 2642 !match_option(option, "-Dsun.java.launcher", &tail)) { 2643 2644 // add all jvm options to the jvm_args string. This string 2645 // is used later to set the java.vm.args PerfData string constant. 2646 // the -Djava.class.path and the -Dsun.java.command options are 2647 // omitted from jvm_args string as each have their own PerfData 2648 // string constant object. 2649 build_jvm_args(option->optionString); 2650 } 2651 2652 // -verbose:[class/gc/jni] 2653 if (match_option(option, "-verbose", &tail)) { 2654 if (!strcmp(tail, ":class") || !strcmp(tail, "")) { 2655 if (FLAG_SET_CMDLINE(bool, TraceClassLoading, true) != Flag::SUCCESS) { 2656 return JNI_EINVAL; 2657 } 2658 if (FLAG_SET_CMDLINE(bool, TraceClassUnloading, true) != Flag::SUCCESS) { 2659 return JNI_EINVAL; 2660 } 2661 } else if (!strcmp(tail, ":gc")) { 2662 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); 2663 } else if (!strcmp(tail, ":jni")) { 2664 if (FLAG_SET_CMDLINE(bool, PrintJNIResolving, true) != Flag::SUCCESS) { 2665 return JNI_EINVAL; 2666 } 2667 } 2668 // -da / -ea / -disableassertions / -enableassertions 2669 // These accept an optional class/package name separated by a colon, e.g., 2670 // -da:java.lang.Thread. 2671 } else if (match_option(option, user_assertion_options, &tail, true)) { 2672 bool enable = option->optionString[1] == 'e'; // char after '-' is 'e' 2673 if (*tail == '\0') { 2674 JavaAssertions::setUserClassDefault(enable); 2675 } else { 2676 assert(*tail == ':', "bogus match by match_option()"); 2677 JavaAssertions::addOption(tail + 1, enable); 2678 } 2679 // -dsa / -esa / -disablesystemassertions / -enablesystemassertions 2680 } else if (match_option(option, system_assertion_options, &tail, false)) { | 384 }; 385 386 // Flags that are aliases for other flags. 387 typedef struct { 388 const char* alias_name; 389 const char* real_name; 390 } AliasedFlag; 391 392 static AliasedFlag const aliased_jvm_flags[] = { 393 { "DefaultMaxRAMFraction", "MaxRAMFraction" }, 394 { "CMSMarkStackSizeMax", "MarkStackSizeMax" }, 395 { "CMSMarkStackSize", "MarkStackSize" }, 396 { "G1MarkStackSize", "MarkStackSize" }, 397 { "ParallelMarkingThreads", "ConcGCThreads" }, 398 { "ParallelCMSThreads", "ConcGCThreads" }, 399 { "CreateMinidumpOnCrash", "CreateCoredumpOnCrash" }, 400 { NULL, NULL} 401 }; 402 403 static AliasedLoggingFlag const aliased_logging_flags[] = { 404 { "TraceClassLoading", LogLevel::Info, true, LogTag::_classload }, 405 { "TraceClassUnloading", LogLevel::Info, true, LogTag::_classunload }, 406 { "TraceClassResolution", LogLevel::Info, true, LogTag::_classresolve }, 407 { "TraceExceptions", LogLevel::Info, true, LogTag::_exceptions }, 408 { "TraceMonitorInflation", LogLevel::Debug, true, LogTag::_monitorinflation }, 409 { NULL, LogLevel::Off, false, LogTag::__NO_TAG } 410 }; 411 412 // Return true if "v" is less than "other", where "other" may be "undefined". 413 static bool version_less_than(JDK_Version v, JDK_Version other) { 414 assert(!v.is_undefined(), "must be defined"); 415 if (!other.is_undefined() && v.compare(other) >= 0) { 416 return false; 417 } else { 418 return true; 419 } 420 } 421 422 static bool lookup_special_flag(const char *flag_name, SpecialFlag& flag) { 423 for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) { 424 if ((strcmp(special_jvm_flags[i].name, flag_name) == 0)) { 425 flag = special_jvm_flags[i]; 2637 for (int index = 0; index < args->nOptions; index++) { 2638 bool is_absolute_path = false; // for -agentpath vs -agentlib 2639 2640 const JavaVMOption* option = args->options + index; 2641 2642 if (!match_option(option, "-Djava.class.path", &tail) && 2643 !match_option(option, "-Dsun.java.command", &tail) && 2644 !match_option(option, "-Dsun.java.launcher", &tail)) { 2645 2646 // add all jvm options to the jvm_args string. This string 2647 // is used later to set the java.vm.args PerfData string constant. 2648 // the -Djava.class.path and the -Dsun.java.command options are 2649 // omitted from jvm_args string as each have their own PerfData 2650 // string constant object. 2651 build_jvm_args(option->optionString); 2652 } 2653 2654 // -verbose:[class/gc/jni] 2655 if (match_option(option, "-verbose", &tail)) { 2656 if (!strcmp(tail, ":class") || !strcmp(tail, "")) { 2657 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(classload)); 2658 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(classunload)); 2659 } else if (!strcmp(tail, ":gc")) { 2660 LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); 2661 } else if (!strcmp(tail, ":jni")) { 2662 if (FLAG_SET_CMDLINE(bool, PrintJNIResolving, true) != Flag::SUCCESS) { 2663 return JNI_EINVAL; 2664 } 2665 } 2666 // -da / -ea / -disableassertions / -enableassertions 2667 // These accept an optional class/package name separated by a colon, e.g., 2668 // -da:java.lang.Thread. 2669 } else if (match_option(option, user_assertion_options, &tail, true)) { 2670 bool enable = option->optionString[1] == 'e'; // char after '-' is 'e' 2671 if (*tail == '\0') { 2672 JavaAssertions::setUserClassDefault(enable); 2673 } else { 2674 assert(*tail == ':', "bogus match by match_option()"); 2675 JavaAssertions::addOption(tail + 1, enable); 2676 } 2677 // -dsa / -esa / -disablesystemassertions / -enablesystemassertions 2678 } else if (match_option(option, system_assertion_options, &tail, false)) { |