comparison src/share/vm/runtime/arguments.cpp @ 6196:3759236eea14

7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used Summary: Send warnings to output stream Reviewed-by: dholmes, fparain
author kamg
date Mon, 02 Jul 2012 10:54:17 -0400
parents f9d57285de70
children 90d5a592ea8f
comparison
equal deleted inserted replaced
6195:bcffa4c5eef6 6196:3759236eea14
2969 2969
2970 // Remaining part of option string 2970 // Remaining part of option string
2971 const char* tail; 2971 const char* tail;
2972 2972
2973 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. 2973 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
2974 const char* hotspotrc = ".hotspotrc";
2974 bool settings_file_specified = false; 2975 bool settings_file_specified = false;
2976 bool needs_hotspotrc_warning = false;
2977
2975 const char* flags_file; 2978 const char* flags_file;
2976 int index; 2979 int index;
2977 for (index = 0; index < args->nOptions; index++) { 2980 for (index = 0; index < args->nOptions; index++) {
2978 const JavaVMOption *option = args->options + index; 2981 const JavaVMOption *option = args->options + index;
2979 if (match_option(option, "-XX:Flags=", &tail)) { 2982 if (match_option(option, "-XX:Flags=", &tail)) {
3013 // Parse specified settings file 3016 // Parse specified settings file
3014 if (settings_file_specified) { 3017 if (settings_file_specified) {
3015 if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) { 3018 if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
3016 return JNI_EINVAL; 3019 return JNI_EINVAL;
3017 } 3020 }
3018 } 3021 } else {
3019
3020 #ifdef ASSERT 3022 #ifdef ASSERT
3021 // Parse default .hotspotrc settings file 3023 // Parse default .hotspotrc settings file
3022 if (!settings_file_specified) {
3023 if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) { 3024 if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) {
3024 return JNI_EINVAL; 3025 return JNI_EINVAL;
3025 } 3026 }
3026 } 3027 #else
3028 struct stat buf;
3029 if (os::stat(hotspotrc, &buf) == 0) {
3030 needs_hotspotrc_warning = true;
3031 }
3027 #endif 3032 #endif
3033 }
3028 3034
3029 if (PrintVMOptions) { 3035 if (PrintVMOptions) {
3030 for (index = 0; index < args->nOptions; index++) { 3036 for (index = 0; index < args->nOptions; index++) {
3031 const JavaVMOption *option = args->options + index; 3037 const JavaVMOption *option = args->options + index;
3032 if (match_option(option, "-XX:", &tail)) { 3038 if (match_option(option, "-XX:", &tail)) {
3037 3043
3038 // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS 3044 // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS
3039 jint result = parse_vm_init_args(args); 3045 jint result = parse_vm_init_args(args);
3040 if (result != JNI_OK) { 3046 if (result != JNI_OK) {
3041 return result; 3047 return result;
3048 }
3049
3050 // Delay warning until here so that we've had a chance to process
3051 // the -XX:-PrintWarnings flag
3052 if (needs_hotspotrc_warning) {
3053 warning("%s file is present but has been ignored. "
3054 "Run with -XX:Flags=%s to load the file.",
3055 hotspotrc, hotspotrc);
3042 } 3056 }
3043 3057
3044 #if (defined JAVASE_EMBEDDED || defined ARM) 3058 #if (defined JAVASE_EMBEDDED || defined ARM)
3045 UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); 3059 UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
3046 #endif 3060 #endif