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

8327138: Clean up status management in cdsConfig.hpp and CDS.java #18095

Closed

Conversation

iklam
Copy link
Member

@iklam iklam commented Mar 2, 2024

A few clean ups:

  1. Rename functions like "s_loading_full_module_graph() to is_using_full_module_graph(). The meaning of "loading" is not clear: it might be interpreted as to cover only the period where the artifact is being loaded, but not the period after the artifact is completely loaded. However, the function is meant to cover both periods, so "using" is a more precise term.

  2. The cumbersome sounding disable_loading_full_module_graph() is changed to stop_using_full_module_graph(), etc.

  3. The status of is_using_optimized_module_handling() is moved from metaspaceShared.hpp to cdsConfig.hpp, to be consolidated with other types of CDS status.

  4. The status of CDS was communicated to the Java class jdk.internal.misc.CDS by ad-hoc native methods. This is now changed to a single method, CDS.getCDSConfigStatus() that returns a bit field. That way we don't need to add a new native method for each type of status.

  5. CDS.isDumpingClassList() was a misnomer. It's changed to CDS.isLoggingLambdaFormInvokers().


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-8327138: Clean up status management in cdsConfig.hpp and CDS.java (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18095

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 2, 2024

👋 Welcome back iklam! 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 Mar 2, 2024
@openjdk
Copy link

openjdk bot commented Mar 2, 2024

@iklam The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot

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

@openjdk openjdk bot added hotspot hotspot-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Mar 2, 2024
@mlbridge
Copy link

mlbridge bot commented Mar 2, 2024

Webrevs

Copy link
Member

@calvinccheung calvinccheung left a comment

Choose a reason for hiding this comment

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

Looks good. Just one nit below.
I assume that it has gone through some testing?

static void stop_dumping_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
static bool is_dumping_full_module_graph() { return CDS_ONLY(_is_dumping_full_module_graph) NOT_CDS(false); }
static void stop_using_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
static bool is_using_full_module_graph() NOT_CDS_JAVA_HEAP_RETURN_(false);
Copy link
Member

Choose a reason for hiding this comment

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

Please align this with line #90.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean aligning like this:

  static bool is_dumping_heap()                              NOT_CDS_JAVA_HEAP_RETURN_(false);
  static void stop_dumping_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
  static bool is_dumping_full_module_graph()                 { return CDS_ONLY(_is_dumping_full_module_graph) NOT_CDS(false); }
  static void stop_using_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
  static bool is_using_full_module_graph()                   NOT_CDS_JAVA_HEAP_RETURN_(false);

I think this is more messy, and you can't easily tell that these four functions are all related to the same feature (full_module_graph).

Copy link
Member

Choose a reason for hiding this comment

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

I meant the following. Just the last line #94 needs to be changed - shift one space to the left after bool.

static bool   is_dumping_heap()                            NOT_CDS_JAVA_HEAP_RETURN_(false);
static void stop_dumping_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
static bool   is_dumping_full_module_graph()               { return CDS_ONLY(_is_dumping_full_module_graph) NOT_CDS(false); }
static void   stop_using_full_module_graph(const char* reason = nullptr) NOT_CDS_JAVA_HEAP_RETURN;
static bool   is_using_full_module_graph()                 NOT_CDS_JAVA_HEAP_RETURN_(false);

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted line 94 to align the "using_full_module_graph" part with the function at line 93.

Copy link
Member

Choose a reason for hiding this comment

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

In that case, it looks good.

@openjdk
Copy link

openjdk bot commented Mar 5, 2024

@iklam 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:

8327138: Clean up status management in cdsConfig.hpp and CDS.java

Reviewed-by: ccheung, matsaave

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 Mar 5, 2024
Copy link
Contributor

@matias9927 matias9927 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Just one comment on format below.

@@ -61,6 +69,7 @@ class CDSConfig : public AllStatic {
static bool is_dumping_dynamic_archive() { return CDS_ONLY(_is_dumping_dynamic_archive) NOT_CDS(false); }
static void enable_dumping_dynamic_archive() { CDS_ONLY(_is_dumping_dynamic_archive = true); }
static void disable_dumping_dynamic_archive() { CDS_ONLY(_is_dumping_dynamic_archive = false); }
static bool is_using_archive() NOT_CDS_RETURN_(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you fix the alignment of the method names here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since several people are confused by the alignment style (align same words to the right), I fixed the grouping of the functions so that the text is aligned to the left, as in most header files.

Please take a look at ae0e0ac -- it's best viewed on GutHub with white spaces hidden.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Some drive-by nits. (But copyright needs fixing.)

* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect copyright update - should be "2023, 2024,"

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Comment on lines 51 to 54
return (is_dumping_archive() ? IS_DUMPING_ARCHIVE : 0) |
(is_dumping_static_archive() ? IS_DUMPING_STATIC_ARCHIVE : 0) |
(is_logging_lambda_form_invokers() ? IS_LOGGING_LAMBDA_FORM_INVOKERS : 0) |
(is_using_archive() ? IS_USING_ARCHIVE : 0);
Copy link
Member

Choose a reason for hiding this comment

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

You can remove one space before the ? in each line

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Comment on lines 53 to 56
static const int IS_DUMPING_ARCHIVE = 1 << 0;
static const int IS_DUMPING_STATIC_ARCHIVE = 1 << 1;
static const int IS_LOGGING_LAMBDA_FORM_INVOKERS = 1 << 2;
static const int IS_USING_ARCHIVE = 1 << 3;
Copy link
Member

Choose a reason for hiding this comment

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

why is the = sign so far away?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@iklam
Copy link
Member Author

iklam commented Mar 9, 2024

Thanks @calvinccheung @matias9927 @dholmes-ora for the review.
/integrate

@openjdk
Copy link

openjdk bot commented Mar 9, 2024

Going to push as commit 761ed25.
Since your change was applied there has been 1 commit pushed to the master branch:

  • 53628f2: 8327492: Remove applet usage and update DisposeInActionEventTest.html

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 9, 2024

@iklam Pushed as commit 761ed25.

💡 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
core-libs core-libs-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants