提交 72fccb97 编写于 作者: K kamg

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
上级 e13550bd
...@@ -550,10 +550,12 @@ void CompilerOracle::parse_from_line(char* line) { ...@@ -550,10 +550,12 @@ void CompilerOracle::parse_from_line(char* line) {
} }
} }
static const char* default_cc_file = ".hotspot_compiler";
static const char* cc_file() { static const char* cc_file() {
#ifdef ASSERT #ifdef ASSERT
if (CompileCommandFile == NULL) if (CompileCommandFile == NULL)
return ".hotspot_compiler"; return default_cc_file;
#endif #endif
return CompileCommandFile; return CompileCommandFile;
} }
...@@ -636,10 +638,17 @@ void compilerOracle_init() { ...@@ -636,10 +638,17 @@ void compilerOracle_init() {
CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
if (CompilerOracle::has_command_file()) { if (CompilerOracle::has_command_file()) {
CompilerOracle::parse_from_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 (lists[PrintCommand] != NULL) {
if (PrintAssembly) { 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)) { } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output"); warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output");
DebugNonSafepoints = true; DebugNonSafepoints = true;
......
...@@ -2971,7 +2971,10 @@ jint Arguments::parse(const JavaVMInitArgs* args) { ...@@ -2971,7 +2971,10 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
const char* tail; const char* tail;
// If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. // 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 settings_file_specified = false;
bool needs_hotspotrc_warning = false;
const char* flags_file; const char* flags_file;
int index; int index;
for (index = 0; index < args->nOptions; index++) { for (index = 0; index < args->nOptions; index++) {
...@@ -3015,16 +3018,19 @@ jint Arguments::parse(const JavaVMInitArgs* args) { ...@@ -3015,16 +3018,19 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) { if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
return JNI_EINVAL; return JNI_EINVAL;
} }
} } else {
#ifdef ASSERT #ifdef ASSERT
// Parse default .hotspotrc settings file // Parse default .hotspotrc settings file
if (!settings_file_specified) {
if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) { if (!process_settings_file(".hotspotrc", false, args->ignoreUnrecognized)) {
return JNI_EINVAL; return JNI_EINVAL;
} }
} #else
struct stat buf;
if (os::stat(hotspotrc, &buf) == 0) {
needs_hotspotrc_warning = true;
}
#endif #endif
}
if (PrintVMOptions) { if (PrintVMOptions) {
for (index = 0; index < args->nOptions; index++) { for (index = 0; index < args->nOptions; index++) {
...@@ -3041,6 +3047,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) { ...@@ -3041,6 +3047,14 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
return result; 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) #if (defined JAVASE_EMBEDDED || defined ARM)
UNSUPPORTED_OPTION(UseG1GC, "G1 GC"); UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册