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

8307468: CDS Lambda Proxy classes are regenerated in dynamic dump #15524

Conversation

calvinccheung
Copy link
Member

@calvinccheung calvinccheung commented Aug 31, 2023

Please review this changeset for fixing the following issues:

  1. for lambda proxy classes already stored in the static archive, during CDS dynamic dump, those classes should not be regenerated and stored in the dynamic archive; (see changes in jvm.cpp)
  2. handle multiple lambda proxy classes with the same invoke dynamic info stored in both static and dynamic archives. (see changes in systemDictionaryShared.cpp)

Also added a test.

Passed tiers 1 - 4 testing.


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-8307468: CDS Lambda Proxy classes are regenerated in dynamic dump (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15524

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 31, 2023

👋 Welcome back ccheung! 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.

@calvinccheung
Copy link
Member Author

/label add hotspot-runtime

@calvinccheung calvinccheung marked this pull request as ready for review August 31, 2023 22:13
@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Aug 31, 2023
@openjdk
Copy link

openjdk bot commented Aug 31, 2023

@calvinccheung
The hotspot-runtime label was successfully added.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 31, 2023
@calvinccheung calvinccheung changed the title 8307468 lambda proxy regenerated 8307468 CDS Lambda Proxy classes are regenerated in dynamic dump Aug 31, 2023
@calvinccheung calvinccheung changed the title 8307468 CDS Lambda Proxy classes are regenerated in dynamic dump 8307468: CDS Lambda Proxy classes are regenerated in dynamic dump Aug 31, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 31, 2023

Webrevs

interface_method_type, m, dynamic_method_type, THREAD);
InstanceKlass* shared_lambda = nullptr;
if (caller_ik->is_shared()) {
shared_lambda = SystemDictionaryShared::get_shared_lambda_proxy_class(caller_ik, interface_method_name, factory_type,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think instead of doing a search here, if we first search in InnerClassLambdaMetafactory.spinInnerClass, we can avoid generating the class when we are dumping the dynamic archive and the lambda proxy class is already present in the static archive.
I think the change proposed by @iklam here is on the same 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.

I've made the changes in InnerClassLambdaMetafactory.java and reverted the changes in jvm.cpp. I also removed the following check in LambdaProxyClassArchive.java:

if (CDS.isDumpingArchive())
            throw new IllegalStateException("cannot load class from CDS archive at dump time");

Will do more testing before posting an update.

@@ -66,7 +66,7 @@ static void test() throws Exception {
"-Xlog:cds=debug",
"-cp", appJar, mainClass, "run")
.assertNormalExit(output -> {
output.shouldContain("Used all archived lambda proxy classes for: UsedAllArchivedLambdasApp run()Ljava/lang/Runnable;")
output.shouldContain("Used all dynamic archived lambda proxy classes for: UsedAllArchivedLambdasApp run()Ljava/lang/Runnable;")
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably worth checking the output for "Used all static archived lambda proxy classes for" as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

The "Used all static archived lambda proxy classes for" log output isn't applicable to the UsedAllArchivedLambdas.java test because the lambda proxy classes are all in the dynamic archive. It could be applicable to the new test. I'll check.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ashu-mehra Could you review my updated changes? Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks fine.

// Generate a class list for static dump.
// Note that the class list contains one less lambda proxy class comparing
// with running the LambdasWithSameKey app with the "run" argument.
String[] launchArgs = {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
String[] launchArgs = {
String[] launchArgs = {

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.

Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

LGTM

@openjdk
Copy link

openjdk bot commented Sep 6, 2023

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

8307468: CDS Lambda Proxy classes are regenerated in dynamic dump

Reviewed-by: iklam

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 159 new commits pushed to the master branch:

  • 024133b: 8311964: Some jtreg tests failing on x86 with error 'unrecognized VM options' (C2 flags)
  • 62a953f: 8315689: G1: Remove unused init_hash_seed
  • cfc1489: 8315579: SPARC64 builds are broken after JDK-8304913
  • f6c203e: 8314949: linux PPC64 Big Endian: Implementation of Foreign Function & Memory API
  • a01b3fb: 8288660: JavaDoc should be more helpful if it doesn't recognize a tag
  • ba1a463: 8315377: C2: assert(u->find_out_with(Op_AddP) == nullptr) failed: more than 2 chained AddP nodes?
  • a258fc4: 8315648: Add test for JDK-8309979 changes
  • 5d3fdc1: 8315612: RISC-V: intrinsic for unsignedMultiplyHigh
  • 5cbff24: 8315406: [REDO] serviceability/jdwp/AllModulesCommandTest.java ignores VM flags
  • 7a08e6b: 8313575: Refactor PKCS11Test tests
  • ... and 149 more: https://git.openjdk.org/jdk/compare/62610203f18095cbd25b456f0622bad033a65a5d...master

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 Sep 6, 2023
@ashu-mehra
Copy link
Contributor

@calvinccheung thanks for addressing the comments. lgtm.

@calvinccheung
Copy link
Member Author

@ashu-mehra, @turbanoff, @iklam Thanks for the review.

/integrate

@openjdk
Copy link

openjdk bot commented Sep 6, 2023

Going to push as commit 25e85db.
Since your change was applied there have been 159 commits pushed to the master branch:

  • 024133b: 8311964: Some jtreg tests failing on x86 with error 'unrecognized VM options' (C2 flags)
  • 62a953f: 8315689: G1: Remove unused init_hash_seed
  • cfc1489: 8315579: SPARC64 builds are broken after JDK-8304913
  • f6c203e: 8314949: linux PPC64 Big Endian: Implementation of Foreign Function & Memory API
  • a01b3fb: 8288660: JavaDoc should be more helpful if it doesn't recognize a tag
  • ba1a463: 8315377: C2: assert(u->find_out_with(Op_AddP) == nullptr) failed: more than 2 chained AddP nodes?
  • a258fc4: 8315648: Add test for JDK-8309979 changes
  • 5d3fdc1: 8315612: RISC-V: intrinsic for unsignedMultiplyHigh
  • 5cbff24: 8315406: [REDO] serviceability/jdwp/AllModulesCommandTest.java ignores VM flags
  • 7a08e6b: 8313575: Refactor PKCS11Test tests
  • ... and 149 more: https://git.openjdk.org/jdk/compare/62610203f18095cbd25b456f0622bad033a65a5d...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 6, 2023

@calvinccheung Pushed as commit 25e85db.

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

@calvinccheung calvinccheung deleted the 8307468-lambda-proxy-regenerated branch September 6, 2023 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants