RFR: 8332176: Refactor ClassListParser::parse()

Calvin Cheung ccheung at openjdk.org
Tue May 14 22:47:01 UTC 2024


On Tue, 14 May 2024 01:44:02 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> 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.

Looks good overall. Found an outdated comment.

src/hotspot/share/cds/classListParser.hpp line 135:

> 133:   static void parse_classlist(const char* classlist_path, ParseMode parse_mode, TRAPS) {
> 134:     ClassListParser parser(classlist_path, parse_mode);
> 135:     parser.parse(THREAD); // returns the number of classes loaded.

The comment is no longer applicable.

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

PR Review: https://git.openjdk.org/jdk/pull/19225#pullrequestreview-2056554332
PR Review Comment: https://git.openjdk.org/jdk/pull/19225#discussion_r1600722289


More information about the hotspot-runtime-dev mailing list