Integrated: 8318811: Compiler directives parser swallows a character after line comments

Volker Simonis simonis at openjdk.org
Fri Oct 27 12:13:39 UTC 2023


On Wed, 25 Oct 2023 11:46:10 GMT, Volker Simonis <simonis at openjdk.org> wrote:

> Currently, the following valid compiler directive file:
> 
> [{
>   match: "*::*",
>   c2: { Exclude: true } // c1 only for startup
> }]
> 
> will be rejected by the parser:
> 
> Syntax error on line 4 byte 2: Expected value separator or object end (one of ',}').
>   At ']'.
> }]
> 
> Parsing of compiler directives failed
> 
> 
> This is because `JSON::skip_line_comment()`, in contradiction to its specification, does **not** "*return the first token after the line comment without consuming it*" but does consumes it.
> 
> The fix is trivial:
> 
> --- a/src/hotspot/share/utilities/json.cpp
> +++ b/src/hotspot/share/utilities/json.cpp
> @@ -580,7 +580,7 @@ u_char JSON::skip_line_comment() {
>      return 0;
>    }
>    next();
> -  return next();
> +  return peek();
>  }

This pull request has now been integrated.

Changeset: 141dae8b
Author:    Volker Simonis <simonis at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/141dae8b76d41accfa02a0250a1c24364cbf6f25
Stats:     21 lines in 2 files changed: 20 ins; 0 del; 1 mod

8318811: Compiler directives parser swallows a character after line comments

Reviewed-by: shade, phh

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

PR: https://git.openjdk.org/jdk/pull/16359


More information about the hotspot-dev mailing list