Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit

Permalink
8263353: assert(CompilerOracle::option_matches_type(option, value)) f…
Browse files Browse the repository at this point in the history
…ailed: Value must match option type

Reviewed-by: neliasso, kvn
  • Loading branch information
DamonFool committed Mar 12, 2021
1 parent cf1c021 commit ad1f605
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/hotspot/share/compiler/compilerOracle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,14 @@ void CompilerOracle::parse_from_line(char* line) {
print_parse_error(error_buf, original.get());
return;
}
register_command(typed_matcher, option, true);
if (option2type(option) == OptionType::Bool) {
register_command(typed_matcher, option, true);
} else {
jio_snprintf(error_buf, sizeof(error_buf), " Missing type '%s' before option '%s'",
optiontype2name(option2type(option)), option2name(option));
print_parse_error(error_buf, original.get());
return;
}
}
assert(typed_matcher != NULL, "sanity");
assert(*error_buf == '\0', "No error here");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/*
* @test TestInvalidCompileCommand
* @bug 8263206
* @bug 8263206 8263353
* @summary Regression tests of -XX:CompileCommand
* @library /test/lib
* @run driver compiler.oracle.TestInvalidCompileCommand
Expand All @@ -40,12 +40,47 @@ public class TestInvalidCompileCommand {
{
"-XX:CompileCommand=unknown",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionDouble,3.14",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionInt,3",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionUint,3",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionStr,hello",
"-version"
},
{
"-XX:CompileCommand=option,Test::test,TestOptionList,hello,world",
"-version"
}
};

private static final String[][] OUTPUTS = {
{
"Unrecognized option 'unknown'"
},
{
"Missing type 'double' before option 'TestOptionDouble'"
},
{
"Missing type 'intx' before option 'TestOptionInt'"
},
{
"Missing type 'uintx' before option 'TestOptionUint'"
},
{
"Missing type 'ccstr' before option 'TestOptionStr'"
},
{
"Missing type 'ccstrlist' before option 'TestOptionList'"
}
};

Expand Down

0 comments on commit ad1f605

Please sign in to comment.