RFR: 8332176: Refactor ClassListParser::parse()

Ioi Lam iklam at openjdk.org
Tue May 14 01:48:26 UTC 2024


The handling of `@` tags in `ClassListParser::parse()` is quite convoluted. As we expect to add more `@` tags in Project Leyden, we should refactor this code to make it more maintainable.

It's easier to review the changes by ignoring the whitespace changes.

- I refactored the parsing to two parts -- `parse_at_tags()` and `parse_class_name_and_attributes()`
- I changed  the `ClassListParser::parse()` to no longer return the number of classes loaded -- some `@` tags can cause many classes to be loaded as a side effect (e.g., `@lambda-form-invoker`), so the number returned by `ClassListParser::parse()` is not accurate. There are other CDS logs that print out the exact number of classes stored in the archive.

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

Commit messages:
 - 8332176: Refactoring ClassListParser::parse()

Changes: https://git.openjdk.org/jdk/pull/19225/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19225&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8332176
  Stats: 154 lines in 3 files changed: 34 ins; 45 del; 75 mod
  Patch: https://git.openjdk.org/jdk/pull/19225.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19225/head:pull/19225

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


More information about the hotspot-runtime-dev mailing list