Skip to content

8364483: [lworld] Pre-register migrated classes in class loaders #1520

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

Closed
wants to merge 3 commits into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Jul 31, 2025

This change preloads and preregisters all classes in the migrated classes lists, in all class loaders.
Tested with tier1 locally and with -XX:+PrintSystemDictionaryAtExit.


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8364483: [lworld] Pre-register migrated classes in class loaders (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1520

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1520.diff

Using Webrev

Link to Webrev Comment

@@ -35,6 +35,7 @@
#include "memory/iterator.inline.hpp"
#include "oops/inlineKlass.inline.hpp"
#include "utilities/debug.hpp"
#include "utilities/copy.hpp"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is unrelated but needed to get the product build to build.

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 31, 2025

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

@openjdk
Copy link

openjdk bot commented Jul 31, 2025

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

8364483: [lworld] Pre-register migrated classes in class loaders

Reviewed-by: heidinga

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 3 new commits pushed to the lworld branch:

  • 4ce51bf: [lworld] Remove redundant DTraceAlloc/Method probes
  • 67e6bcc: 8360653: [lworld] LayoutIterationTest.java fails with -XX:ForceNonTearable=*
  • 4f9deef: 8364321: Add JDI tests for value objects

Please see this link for an up-to-date comparison between the source branch of this pull request and the lworld 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 lworld branch, type /integrate in a new comment.

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 31, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 31, 2025

Webrevs

template<typename Function>
static void migrated_class_names_do(Function f) {
for (int i = 0; i < _migrated_class_names_length; i++) {
//f->do_symbol(&_migrated_class_names[i]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Commented line to be removed?

@coleenp
Copy link
Contributor Author

coleenp commented Aug 11, 2025

I don't love having to enumerate all the classes in more than one place, but I also don't want to add another X macro.

_migrated_class_names[i++] = java_time_chrono_MinguoDate();
_migrated_class_names[i++] = java_time_chrono_HijrahDate();
_migrated_class_names[i++] = java_time_chrono_JapaneseDate();
_migrated_class_names[i++] = java_time_chrono_ThaiBuddhistDate();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this assert(i == _migrated_class_names_length); as a handshake with the size of the set of migrated classes declared in vmSymbols.hpp?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea. I didn't know a better C++ way to initialize these. I'm sure it exists.

@coleenp
Copy link
Contributor Author

coleenp commented Aug 12, 2025

Thanks again, Dan.
/integrate

@openjdk
Copy link

openjdk bot commented Aug 12, 2025

Going to push as commit ed21796.
Since your change was applied there have been 3 commits pushed to the lworld branch:

  • 4ce51bf: [lworld] Remove redundant DTraceAlloc/Method probes
  • 67e6bcc: 8360653: [lworld] LayoutIterationTest.java fails with -XX:ForceNonTearable=*
  • 4f9deef: 8364321: Add JDI tests for value objects

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 12, 2025

@coleenp Pushed as commit ed21796.

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

@coleenp coleenp deleted the initiated-classes branch August 13, 2025 17:22
@RogerRiggs
Copy link
Collaborator

The official list of migrated classes is in make/modules/java.base/gensrc/GensrcValueClasses.gmk.
How are all these copies of the list of files kept in sync?

@DanHeidinga
Copy link
Contributor

The official list of migrated classes is in make/modules/java.base/gensrc/GensrcValueClasses.gmk.
How are all these copies of the list of files kept in sync?

This is a temporary measure to make up for classfiles that don't have a LoadedDescriptors attribute yet. Those classes - in user class loaders - won't "know" at link time that the box classes have migrated to be values and therefore won't benefit from the calling convention optimizations. This PR lets us make those classloaders aware of the changed nature of the boxing classes early and ensures they get the benefits of Valhalla. The other migrated classes are included because "why not" and so keeping the lists in sync isn't a priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants