7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used

Mon, 02 Jul 2012 10:54:17 -0400

author
kamg
date
Mon, 02 Jul 2012 10:54:17 -0400
changeset 3899
3759236eea14
parent 3898
bcffa4c5eef6
child 3907
90d5a592ea8f
child 3923
922993931b3d

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

src/share/vm/compiler/compilerOracle.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/compiler/compilerOracle.cpp	Fri Jun 29 17:12:15 2012 -0700
     1.2 +++ b/src/share/vm/compiler/compilerOracle.cpp	Mon Jul 02 10:54:17 2012 -0400
     1.3 @@ -550,10 +550,12 @@
     1.4    }
     1.5  }
     1.6  
     1.7 +static const char* default_cc_file = ".hotspot_compiler";
     1.8 +
     1.9  static const char* cc_file() {
    1.10  #ifdef ASSERT
    1.11    if (CompileCommandFile == NULL)
    1.12 -    return ".hotspot_compiler";
    1.13 +    return default_cc_file;
    1.14  #endif
    1.15    return CompileCommandFile;
    1.16  }
    1.17 @@ -636,10 +638,17 @@
    1.18    CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
    1.19    if (CompilerOracle::has_command_file()) {
    1.20      CompilerOracle::parse_from_file();
    1.21 +  } else {
    1.22 +    struct stat buf;
    1.23 +    if (os::stat(default_cc_file, &buf) == 0) {
    1.24 +      warning("%s file is present but has been ignored.  "
    1.25 +              "Run with -XX:CompileCommandFile=%s to load the file.",
    1.26 +              default_cc_file, default_cc_file);
    1.27 +    }
    1.28    }
    1.29    if (lists[PrintCommand] != NULL) {
    1.30      if (PrintAssembly) {
    1.31 -      warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled");
    1.32 +      warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file);
    1.33      } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
    1.34        warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output");
    1.35        DebugNonSafepoints = true;
     2.1 --- a/src/share/vm/runtime/arguments.cpp	Fri Jun 29 17:12:15 2012 -0700
     2.2 +++ b/src/share/vm/runtime/arguments.cpp	Mon Jul 02 10:54:17 2012 -0400
     2.3 @@ -2971,7 +2971,10 @@
     2.4    const char* tail;
     2.5  
     2.6    // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
     2.7 +  const char* hotspotrc = ".hotspotrc";
     2.8    bool settings_file_specified = false;
     2.9 +  bool needs_hotspotrc_warning = false;
    2.10 +
    2.11    const char* flags_file;
    2.12    int index;
    2.13    for (index = 0; index < args->nOptions; index++) {
    2.14 @@ -3015,16 +3018,19 @@
    2.15      if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
    2.16        return JNI_EINVAL;
    2.17      }
    2.18 -  }
    2.19 -
    2.20 +  } else {
    2.21  #ifdef ASSERT
    2.22 -  // Parse default .hotspotrc settings file
    2.23 -  if (!settings_file_specified) {
    2.24 +    // Parse default .hotspotrc settings file
    2.25      if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) {
    2.26        return JNI_EINVAL;
    2.27      }
    2.28 +#else
    2.29 +    struct stat buf;
    2.30 +    if (os::stat(hotspotrc, &buf) == 0) {
    2.31 +      needs_hotspotrc_warning = true;
    2.32 +    }
    2.33 +#endif
    2.34    }
    2.35 -#endif
    2.36  
    2.37    if (PrintVMOptions) {
    2.38      for (index = 0; index < args->nOptions; index++) {
    2.39 @@ -3041,6 +3047,14 @@
    2.40      return result;
    2.41    }
    2.42  
    2.43 +  // Delay warning until here so that we've had a chance to process
    2.44 +  // the -XX:-PrintWarnings flag
    2.45 +  if (needs_hotspotrc_warning) {
    2.46 +    warning("%s file is present but has been ignored.  "
    2.47 +            "Run with -XX:Flags=%s to load the file.",
    2.48 +            hotspotrc, hotspotrc);
    2.49 +  }
    2.50 +
    2.51  #if (defined JAVASE_EMBEDDED || defined ARM)
    2.52    UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
    2.53  #endif

mercurial