RFR: JDK-8310316: Failing HotSpot Compiler directives are too verbose

Eric Nothum duke at openjdk.org
Fri Jul 21 12:41:48 UTC 2023


Previously jcmd printed the whole file if a compiler directive was added that was not in json format. This example illustrates the issue:


./jcmd 331311 Compiler.directives_add ./example.txt
331311:
Syntax error on line 1 byte 1: Json must start with an object or an array.
  At 'This'.
This is my very interesting text,
followed by some more exciting text.

Parsing of compiler directives failed
Could not load file: ./example.txt

The json error message is not printed if the silent field is set in the `DirectivesParser` object.
The proposed change adds a boolean parameter silent that is propagated from `CompilerDirectivesAddDCmd::execute` to the `DirectivesParser` constructor. The default value for the new parameter is set to false, which represents the original behavior. In case where a compiler directive is added, the parameter is set to true and the error message will be reduced.

The proposed change reduces the error message to:


./jcmd 335703 Compiler.directives_add ./example.txt
335703:
Parsing of compiler directives failed
Could not load file: ./example.txt

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

Commit messages:
 - Fixed verbose compiler directive, by propagating silent from CompilerDirectivesAddDCmd::execute

Changes: https://git.openjdk.org/jdk/pull/14957/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14957&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8310316
  Stats: 10 lines in 3 files changed: 0 ins; 0 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/14957.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14957/head:pull/14957

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


More information about the hotspot-dev mailing list