RFR: 8257800: CompileCommand TypedMethodOptionMatcher::parse_method_pattern() may over consume

Claes Redestad redestad at openjdk.java.net
Sun Dec 6 23:54:13 UTC 2020


On Sun, 6 Dec 2020 22:50:40 GMT, Xin Liu <xliu at openjdk.org> wrote:

> if users don't specify method_name in CompileCommand, hotspot will over consume a token.
> in debug build, it may hit the assertion of type mismatch.

Changes requested by redestad (Reviewer).

src/hotspot/share/compiler/methodMatcher.cpp line 280:

> 278:         CompileCommand::Unknown != CompilerOracle::string_to_option(method_name)) &&
> 279:         strstr(line + bytes_read, method_name) == NULL) {
> 280:       error_msg = "not specify any method pattern";

"Did not specify any method pattern", perhaps?

src/hotspot/share/compiler/methodMatcher.cpp line 241:

> 239: }
> 240: 
> 241: enum OptionType parse_option_type(const char* type_str);

Hmm, rather than a surprising forward declaration to a method declared in compilerOracle.cpp (does this actually work?) maybe declare that method publically as `CompilerOracle::parse_option_type` and call that?

src/hotspot/share/compiler/methodMatcher.cpp line 282:

> 280:       error_msg = "not specify any method pattern";
> 281:       m_match = MethodMatcher::Unknown;
> 282:       bytes_read -= strlen(method_name);

Windows build fails on this with "conversion from 'size_t' to 'int'"

-------------

PR: https://git.openjdk.java.net/jdk/pull/1652


More information about the hotspot-compiler-dev mailing list