# HG changeset patch # User kamg # Date 1341871384 14400 # Node ID 3f142ec74a266ee1d29a34f2c99a5382f70c07f3 # Parent ab0720e5abbb451ecb652e8c5ec7965e42bc672e 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 diff -r ab0720e5abbb -r 3f142ec74a26 src/share/vm/compiler/compilerOracle.cpp --- a/src/share/vm/compiler/compilerOracle.cpp Mon Jun 25 15:34:06 2012 -0400 +++ b/src/share/vm/compiler/compilerOracle.cpp Mon Jul 09 18:03:04 2012 -0400 @@ -550,10 +550,12 @@ } } +static const char* default_cc_file = ".hotspot_compiler"; + static const char* cc_file() { #ifdef ASSERT if (CompileCommandFile == NULL) { - return ".hotspot_compiler"; + return default_cc_file; } #endif return CompileCommandFile; @@ -637,10 +639,17 @@ CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); if (CompilerOracle::has_command_file()) { CompilerOracle::parse_from_file(); + } else { + struct stat buf; + if (os::stat(default_cc_file, &buf) == 0) { + warning("%s file is present but has been ignored. " + "Run with -XX:CompileCommandFile=%s to load the file.", + default_cc_file, default_cc_file); + } } if (lists[PrintCommand] != NULL) { if (PrintAssembly) { - warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled"); + warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file); } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) { warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output"); DebugNonSafepoints = true; diff -r ab0720e5abbb -r 3f142ec74a26 src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Mon Jun 25 15:34:06 2012 -0400 +++ b/src/share/vm/runtime/arguments.cpp Mon Jul 09 18:03:04 2012 -0400 @@ -2955,7 +2955,10 @@ const char* tail; // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. + const char* hotspotrc = ".hotspotrc"; bool settings_file_specified = false; + bool needs_hotspotrc_warning = false; + const char* flags_file; int index; for (index = 0; index < args->nOptions; index++) { @@ -2999,16 +3002,19 @@ if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) { return JNI_EINVAL; } - } - + } else { #ifdef ASSERT - // Parse default .hotspotrc settings file - if (!settings_file_specified) { + // Parse default .hotspotrc settings file if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) { return JNI_EINVAL; } +#else + struct stat buf; + if (os::stat(hotspotrc, &buf) == 0) { + needs_hotspotrc_warning = true; + } +#endif } -#endif if (PrintVMOptions) { for (index = 0; index < args->nOptions; index++) { @@ -3025,6 +3031,14 @@ return result; } + // Delay warning until here so that we've had a chance to process + // the -XX:-PrintWarnings flag + if (needs_hotspotrc_warning) { + warning("%s file is present but has been ignored. " + "Run with -XX:Flags=%s to load the file.", + hotspotrc, hotspotrc); + } + #if (defined JAVASE_EMBEDDED || defined ARM) UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); #endif