Skip to content

Commit

Permalink
8310316: Failing HotSpot Compiler directives are too verbose
Browse files Browse the repository at this point in the history
Reviewed-by: thartmann, chagedorn
  • Loading branch information
enothum authored and TobiHartmann committed Jul 24, 2023
1 parent f3ade38 commit 04f39e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/hotspot/share/compiler/directivesParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ void DirectivesParser::clean_tmp() {
assert(_tmp_depth == 0, "Consistency");
}

int DirectivesParser::parse_string(const char* text, outputStream* st) {
DirectivesParser cd(text, st, false);
int DirectivesParser::parse_string(const char* text, outputStream* st, bool silent) {
DirectivesParser cd(text, st, silent);
if (cd.valid()) {
return cd.install_directives();
} else {
Expand All @@ -77,16 +77,16 @@ bool DirectivesParser::parse_from_flag() {
return parse_from_file(CompilerDirectivesFile, tty);
}

bool DirectivesParser::parse_from_file(const char* filename, outputStream* st) {
bool DirectivesParser::parse_from_file(const char* filename, outputStream* st, bool silent) {
assert(filename != nullptr, "Test before calling this");
if (!parse_from_file_inner(filename, st)) {
if (!parse_from_file_inner(filename, st, silent)) {
st->print_cr("Could not load file: %s", filename);
return false;
}
return true;
}

bool DirectivesParser::parse_from_file_inner(const char* filename, outputStream* stream) {
bool DirectivesParser::parse_from_file_inner(const char* filename, outputStream* stream, bool silent) {
struct stat st;
ResourceMark rm;
if (os::stat(filename, &st) == 0) {
Expand All @@ -99,7 +99,7 @@ bool DirectivesParser::parse_from_file_inner(const char* filename, outputStream*
::close(file_handle);
if (num_read >= 0) {
buffer[num_read] = '\0';
return parse_string(buffer, stream) > 0;
return parse_string(buffer, stream, silent) > 0;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/compiler/directivesParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ class DirectivesParser : public JSON {
public:
static bool has_file();
static bool parse_from_flag();
static bool parse_from_file(const char* filename, outputStream* st);
static int parse_string(const char* string, outputStream* st);
static bool parse_from_file(const char* filename, outputStream* st, bool silent = false);
static int parse_string(const char* string, outputStream* st, bool silent = false);
int install_directives();

private:
DirectivesParser(const char* text, outputStream* st, bool silent);
~DirectivesParser();

bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
static bool parse_from_file_inner(const char* filename, outputStream* st);
static bool parse_from_file_inner(const char* filename, outputStream* st, bool silent = false);

// types of "keys". i.e recognized <key>:<value> pairs in our JSON syntax
typedef enum {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/services/diagnosticCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ CompilerDirectivesAddDCmd::CompilerDirectivesAddDCmd(outputStream* output, bool
}

void CompilerDirectivesAddDCmd::execute(DCmdSource source, TRAPS) {
DirectivesParser::parse_from_file(_filename.value(), output());
DirectivesParser::parse_from_file(_filename.value(), output(), true);
}

void CompilerDirectivesRemoveDCmd::execute(DCmdSource source, TRAPS) {
Expand Down

1 comment on commit 04f39e1

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.