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

8320935: Move CDS config initialization code to cdsConfig.cpp #16868

Conversation

iklam
Copy link
Member

@iklam iklam commented Nov 28, 2023

This is a simple clean up that moves the code for initializing the CDS config states from arguments.cpp to cdsConfig.cpp

I renamed a few functions, but otherwise the code is unchanged.

  • get_default_shared_archive_path() -> default_archive_path()
  • GetSharedArchivePath() -> static_archive_path()
  • GetSharedDynamicArchivePath() -> dynamic_archive_path()

There's also less #if INCLUDE_CDS since the entire cdsConfig.cpp file is compiled only if CDS is enabled.


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-8320935: Move CDS config initialization code to cdsConfig.cpp (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16868

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

Using diff file

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

Webrev

Link to Webrev Comment

@iklam iklam marked this pull request as ready for review November 28, 2023 23:25
@bridgekeeper
Copy link

bridgekeeper bot commented Nov 28, 2023

👋 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 Nov 28, 2023
@openjdk
Copy link

openjdk bot commented Nov 28, 2023

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

  • hotspot
  • serviceability

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 serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Nov 28, 2023
@mlbridge
Copy link

mlbridge bot commented Nov 28, 2023

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.

Code migration from arguments cpp to cdsConfig.cpp looks good.
Found a minor simplification regarding the include statements.

#include "logging/log.hpp"
#include "runtime/arguments.hpp"
#include "runtime/java.hpp"
Copy link
Member

Choose a reason for hiding this comment

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

I was able to build with your patch without including java.hpp.
The #include java.hpp could also be removed from arguments.cpp.

Copy link
Member Author

Choose a reason for hiding this comment

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

cdsConfig.cpp needs the declaration of vm_exit_during_initialization() from java.hpp. Although java.hpp is included by arguments.hpp, we usually try to avoid such indirectly inclusions. Otherwise if arguments.hpp is changed to no longer include java.hpp, then cdsConfig.hpp will fail to compile.

I am not sure about arguments.cpp -- if java.hpp is already included by arguments.hpp, do we need to explicitly include it in arguments.cpp? I'll leave that alone in this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation. Looks good then.

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.

This looks good! I think this is a good opportunity to refactor some of the code for better readability so I left some comments below.

log_info(cds)("full module graph: disabled due to incompatible property: %s=%s", key, value);
}
#endif
CDSConfig::check_system_property(key, value);
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this is only called once, do you expect this method to be used again? It may be unnecessary to extract this code into its own method.

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 to move the code from arguments.cpp to cdsConfig.cpp, so I had to put it in a new function.


void CDSConfig::extract_shared_archive_paths(const char* archive_path,
char** base_archive_path,
char** top_archive_path) {
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 align these arguments?

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.

*top_archive_path = cur_path;
}

void CDSConfig::init_shared_archive_paths() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I see this there is a lot of indentation thanks to the nested conditionals. I don't have much to offer but is there a cleaner way to format this method? Maybe you can extract the code in if (archives == 1) into its own method for better readability.

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 want to keep the code change minimal while moving code from one file to another. I'll refactor this function in a follow-on PR. That way it will be easier to track the code history.

@openjdk
Copy link

openjdk bot commented Dec 2, 2023

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

8320935: Move CDS config initialization code to cdsConfig.cpp

Reviewed-by: ccheung, matsaave, stuefe

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 1 new commit pushed to the master branch:

  • 430564c: 8308715: Create a mechanism for Implicitly Declared Class javadoc

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Dec 2, 2023
Copy link
Member

@tstuefe tstuefe 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. Did not find any functional difference to the original code.

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.

Thanks for addressing my comments. Approved!

@iklam
Copy link
Member Author

iklam commented Dec 6, 2023

Thanks @calvinccheung @matias9927 @tstuefe for the review.
/integrate

@openjdk
Copy link

openjdk bot commented Dec 6, 2023

Going to push as commit 4c96aac.
Since your change was applied there have been 6 commits pushed to the master branch:

  • 78d0958: 8321406: Null IDs should be resolved as before catalogs are added
  • aaaae3e: 8321207: javac is not accepting correct code
  • 86b27b7: 8317831: compiler/codecache/CheckLargePages.java fails on OL 8.8 with unexpected memory string
  • 3cd65ce: 8321325: Remove unused Java_java_awt_MenuComponent_initIDs function
  • 905137d: 8321219: runtime/jni/FastGetField: assert(is_interpreted_frame()) failed: interpreted frame expected
  • 430564c: 8308715: Create a mechanism for Implicitly Declared Class javadoc

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 6, 2023

@iklam Pushed as commit 4c96aac.

💡 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 serviceability serviceability-dev@openjdk.org
4 participants