Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 12322:72b7e96c1922
8024545: make develop and notproduct flag values available in product builds
Reviewed-by: dholmes, kvn
author | twisti |
---|---|
date | Thu, 26 Sep 2013 12:07:53 -0700 |
parents | da051ce490eb |
children | 510fbd28919c a07c25e4f67e |
comparison
equal
deleted
inserted
replaced
12295:1b64d46620a3 | 12322:72b7e96c1922 |
---|---|
623 default: | 623 default: |
624 ShouldNotReachHere(); | 624 ShouldNotReachHere(); |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
628 static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) { | 628 static bool set_bool_flag(char* name, bool value, Flag::Flags origin) { |
629 return CommandLineFlags::boolAtPut(name, &value, origin); | 629 return CommandLineFlags::boolAtPut(name, &value, origin); |
630 } | 630 } |
631 | 631 |
632 static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) { | 632 static bool set_fp_numeric_flag(char* name, char* value, Flag::Flags origin) { |
633 double v; | 633 double v; |
634 if (sscanf(value, "%lf", &v) != 1) { | 634 if (sscanf(value, "%lf", &v) != 1) { |
635 return false; | 635 return false; |
636 } | 636 } |
637 | 637 |
639 return true; | 639 return true; |
640 } | 640 } |
641 return false; | 641 return false; |
642 } | 642 } |
643 | 643 |
644 static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) { | 644 static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) { |
645 julong v; | 645 julong v; |
646 intx intx_v; | 646 intx intx_v; |
647 bool is_neg = false; | 647 bool is_neg = false; |
648 // Check the sign first since atomull() parses only unsigned values. | 648 // Check the sign first since atomull() parses only unsigned values. |
649 if (*value == '-') { | 649 if (*value == '-') { |
672 return true; | 672 return true; |
673 } | 673 } |
674 return false; | 674 return false; |
675 } | 675 } |
676 | 676 |
677 static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) { | 677 static bool set_string_flag(char* name, const char* value, Flag::Flags origin) { |
678 if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; | 678 if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; |
679 // Contract: CommandLineFlags always returns a pointer that needs freeing. | 679 // Contract: CommandLineFlags always returns a pointer that needs freeing. |
680 FREE_C_HEAP_ARRAY(char, value, mtInternal); | 680 FREE_C_HEAP_ARRAY(char, value, mtInternal); |
681 return true; | 681 return true; |
682 } | 682 } |
683 | 683 |
684 static bool append_to_string_flag(char* name, const char* new_value, FlagValueOrigin origin) { | 684 static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags origin) { |
685 const char* old_value = ""; | 685 const char* old_value = ""; |
686 if (!CommandLineFlags::ccstrAt(name, &old_value)) return false; | 686 if (!CommandLineFlags::ccstrAt(name, &old_value)) return false; |
687 size_t old_len = old_value != NULL ? strlen(old_value) : 0; | 687 size_t old_len = old_value != NULL ? strlen(old_value) : 0; |
688 size_t new_len = strlen(new_value); | 688 size_t new_len = strlen(new_value); |
689 const char* value; | 689 const char* value; |
707 FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal); | 707 FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal); |
708 } | 708 } |
709 return true; | 709 return true; |
710 } | 710 } |
711 | 711 |
712 bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) { | 712 bool Arguments::parse_argument(const char* arg, Flag::Flags origin) { |
713 | 713 |
714 // range of acceptable characters spelled out for portability reasons | 714 // range of acceptable characters spelled out for portability reasons |
715 #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" | 715 #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" |
716 #define BUFLEN 255 | 716 #define BUFLEN 255 |
717 char name[BUFLEN+1]; | 717 char name[BUFLEN+1]; |
848 st->print_cr(""); | 848 st->print_cr(""); |
849 } | 849 } |
850 } | 850 } |
851 | 851 |
852 bool Arguments::process_argument(const char* arg, | 852 bool Arguments::process_argument(const char* arg, |
853 jboolean ignore_unrecognized, FlagValueOrigin origin) { | 853 jboolean ignore_unrecognized, Flag::Flags origin) { |
854 | 854 |
855 JDK_Version since = JDK_Version(); | 855 JDK_Version since = JDK_Version(); |
856 | 856 |
857 if (parse_argument(arg, origin) || ignore_unrecognized) { | 857 if (parse_argument(arg, origin) || ignore_unrecognized) { |
858 return true; | 858 return true; |
902 Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true); | 902 Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true); |
903 if (fuzzy_matched != NULL) { | 903 if (fuzzy_matched != NULL) { |
904 jio_fprintf(defaultStream::error_stream(), | 904 jio_fprintf(defaultStream::error_stream(), |
905 "Did you mean '%s%s%s'?\n", | 905 "Did you mean '%s%s%s'?\n", |
906 (fuzzy_matched->is_bool()) ? "(+/-)" : "", | 906 (fuzzy_matched->is_bool()) ? "(+/-)" : "", |
907 fuzzy_matched->name, | 907 fuzzy_matched->_name, |
908 (fuzzy_matched->is_bool()) ? "" : "=<value>"); | 908 (fuzzy_matched->is_bool()) ? "" : "=<value>"); |
909 } | 909 } |
910 } | 910 } |
911 | 911 |
912 // allow for commandline "commenting out" options like -XX:#+Verbose | 912 // allow for commandline "commenting out" options like -XX:#+Verbose |
950 if (c == '\n' || (!in_quote && isspace(c))) { | 950 if (c == '\n' || (!in_quote && isspace(c))) { |
951 // token ends at newline, or at unquoted whitespace | 951 // token ends at newline, or at unquoted whitespace |
952 // this allows a way to include spaces in string-valued options | 952 // this allows a way to include spaces in string-valued options |
953 token[pos] = '\0'; | 953 token[pos] = '\0'; |
954 logOption(token); | 954 logOption(token); |
955 result &= process_argument(token, ignore_unrecognized, CONFIG_FILE); | 955 result &= process_argument(token, ignore_unrecognized, Flag::CONFIG_FILE); |
956 build_jvm_flags(token); | 956 build_jvm_flags(token); |
957 pos = 0; | 957 pos = 0; |
958 in_white_space = true; | 958 in_white_space = true; |
959 in_quote = false; | 959 in_quote = false; |
960 } else if (!in_quote && (c == '\'' || c == '"')) { | 960 } else if (!in_quote && (c == '\'' || c == '"')) { |
968 } | 968 } |
969 c = getc(stream); | 969 c = getc(stream); |
970 } | 970 } |
971 if (pos > 0) { | 971 if (pos > 0) { |
972 token[pos] = '\0'; | 972 token[pos] = '\0'; |
973 result &= process_argument(token, ignore_unrecognized, CONFIG_FILE); | 973 result &= process_argument(token, ignore_unrecognized, Flag::CONFIG_FILE); |
974 build_jvm_flags(token); | 974 build_jvm_flags(token); |
975 } | 975 } |
976 fclose(stream); | 976 fclose(stream); |
977 return result; | 977 return result; |
978 } | 978 } |
2432 if (result != JNI_OK) { | 2432 if (result != JNI_OK) { |
2433 return result; | 2433 return result; |
2434 } | 2434 } |
2435 | 2435 |
2436 // Parse JavaVMInitArgs structure passed in | 2436 // Parse JavaVMInitArgs structure passed in |
2437 result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, COMMAND_LINE); | 2437 result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, Flag::COMMAND_LINE); |
2438 if (result != JNI_OK) { | 2438 if (result != JNI_OK) { |
2439 return result; | 2439 return result; |
2440 } | 2440 } |
2441 | 2441 |
2442 if (AggressiveOpts) { | 2442 if (AggressiveOpts) { |
2519 } | 2519 } |
2520 | 2520 |
2521 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, | 2521 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, |
2522 SysClassPath* scp_p, | 2522 SysClassPath* scp_p, |
2523 bool* scp_assembly_required_p, | 2523 bool* scp_assembly_required_p, |
2524 FlagValueOrigin origin) { | 2524 Flag::Flags origin) { |
2525 // Remaining part of option string | 2525 // Remaining part of option string |
2526 const char* tail; | 2526 const char* tail; |
2527 | 2527 |
2528 // iterate over arguments | 2528 // iterate over arguments |
2529 for (int index = 0; index < args->nOptions; index++) { | 2529 for (int index = 0; index < args->nOptions; index++) { |
3342 logOption(tail); | 3342 logOption(tail); |
3343 } | 3343 } |
3344 } | 3344 } |
3345 } | 3345 } |
3346 | 3346 |
3347 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, ENVIRON_VAR)); | 3347 return(parse_each_vm_init_arg(&vm_args, scp_p, scp_assembly_required_p, Flag::ENVIRON_VAR)); |
3348 } | 3348 } |
3349 return JNI_OK; | 3349 return JNI_OK; |
3350 } | 3350 } |
3351 | 3351 |
3352 void Arguments::set_shared_spaces_flags() { | 3352 void Arguments::set_shared_spaces_flags() { |