Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8318811: Compiler directives parser swallows a character after line comments #16359

Closed

Conversation

simonis
Copy link
Member

@simonis simonis commented Oct 25, 2023

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();
 }

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8318811: Compiler directives parser swallows a character after line comments (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16359/head:pull/16359
$ git checkout pull/16359

Update a local copy of the PR:
$ git checkout pull/16359
$ git pull https://git.openjdk.org/jdk.git pull/16359/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16359

View PR using the GUI difftool:
$ git pr show -t 16359

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16359.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 25, 2023

👋 Welcome back simonis! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 25, 2023
@openjdk
Copy link

openjdk bot commented Oct 25, 2023

@simonis The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Oct 25, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 25, 2023

Webrevs

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

This looks okay and matching what JSON::skip_block_comment -- which is specified similarly -- is doing.

@openjdk
Copy link

openjdk bot commented Oct 25, 2023

@simonis This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8318811: Compiler directives parser swallows a character after line comments

Reviewed-by: shade, phh

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 29 new commits pushed to the master branch:

  • a542f73: 8318843: ProblemList java/lang/management/MemoryMXBean/CollectionUsageThreshold.java in Xcomp
  • d96f38b: 8317510: Change Windows debug symbol files naming to avoid losing info when an executable and a library share the same name
  • 10427c0: 8318613: ChoiceFormat patterns are not well tested
  • ca3bdfc: 8318186: ChoiceFormat inconsistency between applyPattern() and setChoices()
  • a520887: 8318487: Specification of the ListFormat.equals() method can be improved
  • cf4ede0: 8317360: Missing null checks in JfrCheckpointManager and JfrStringPool initialization routines
  • 9e98ee6: 8318735: RISC-V: Enable related hotspot tests run on riscv
  • 29d462a: 8318727: Enable parallelism in vmTestbase/vm/gc/concurrent tests
  • 43f31d7: 8318607: Enable parallelism in vmTestbase/nsk/stress/jni tests
  • cee44a6: 8318608: Enable parallelism in vmTestbase/nsk/stress/threads tests
  • ... and 19 more: https://git.openjdk.org/jdk/compare/e67550cfec4dbd1c8c2c9869dda34fa09a5c274b...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 25, 2023
@simonis
Copy link
Member Author

simonis commented Oct 27, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Oct 27, 2023

Going to push as commit 141dae8.
Since your change was applied there have been 51 commits pushed to the master branch:

  • 667cca9: 8288899: java/util/concurrent/ExecutorService/CloseTest.java failed with "InterruptedException: sleep interrupted"
  • b9dcd4b: 8318964: Fix build failures caused by 8315097
  • d52a995: 8315097: Rename createJavaProcessBuilder
  • 957703b: 8307168: Inconsistent validation and handling of --system flag arguments
  • 5b5fd36: 8316632: Shenandoah: Raise OOME when gc threshold is exceeded
  • abad040: 8313781: Add regression tests for large page logging and user-facing error messages
  • 9123961: 8318096: Introduce AsymmetricKey interface with a getParams method
  • 4a142c3: 8274122: java/io/File/createTempFile/SpecialTempFile.java fails in Windows 11
  • 77fe0fd: 8272215: Add InetAddress methods for parsing IP address literals
  • a9b31b5: 8318689: jtreg is confused when folder name is the same as the test name
  • ... and 41 more: https://git.openjdk.org/jdk/compare/e67550cfec4dbd1c8c2c9869dda34fa09a5c274b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 27, 2023
@openjdk openjdk bot closed this Oct 27, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 27, 2023
@openjdk
Copy link

openjdk bot commented Oct 27, 2023

@simonis Pushed as commit 141dae8.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
3 participants