Skip to content

8293337: Store method handle intrinsics in AOT cache#20959

Closed
iklam wants to merge 19 commits intoopenjdk:pr/20958from
iklam:jep-483-step-05-8293337-archive-method-handle-intrinsics
Closed

8293337: Store method handle intrinsics in AOT cache#20959
iklam wants to merge 19 commits intoopenjdk:pr/20958from
iklam:jep-483-step-05-8293337-archive-method-handle-intrinsics

Conversation

@iklam
Copy link
Member

@iklam iklam commented Sep 12, 2024

This is the 5th PR for JEP 483: Ahead-of-Time Class Loading & Linking.

This PR is necessary to support JDK-8293336: AOT-linking of invokedynamic for lambda expression and string concat, which needs to store Java heap objects that have native pointers to the C++ Method objects returned by SystemDictionary::find_method_handle_intrinsic()

These Method objects are created within the JVM. They do not belong to any actual Java classes. We store all these Method objects into the AOT cache, so that they can be referenced by other artifacts in the AOT cache.


See here for the sequence of dependent RFEs for implementing JEP 483.


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

Integration blockers

 ⚠️ Dependency #20958 must be integrated first
 ⚠️ Title mismatch between PR and JBS for issue JDK-8293337

Issue

  • JDK-8293337: Store method handle intrinsics in AOTCache (Enhancement - P4) ⚠️ Title mismatch between PR and JBS.

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20959

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

Using diff file

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

Webrev

Link to Webrev Comment

iklam added 6 commits August 20, 2024 11:40
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 12, 2024

👋 Welcome back iklam! A progress list of the required criteria for merging this PR into pr/20958 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 Sep 12, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Sep 12, 2024

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

  • hotspot

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

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Sep 12, 2024
@iklam iklam marked this pull request as ready for review September 13, 2024 07:36
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 13, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 13, 2024

…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
Copy link
Contributor

@vnkozlov vnkozlov 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 to me. But I am not expert in this code.

…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
@openjdk
Copy link

openjdk bot commented Sep 18, 2024

⚠️ @iklam This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 18, 2024
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 18, 2024
Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

I have one question, but this is good. I've always wanted these to be shared.

assert(created, "must be");
}
}
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add // INCLUDE_CDS

This is called at startup time before anything so it doesn't need the locking?

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 added the INCLUDE_CDS. I also added locking (or assert safepoint). They are probably not needed now, but will make the code safer in case someone tries to move or refactor it.

…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
Copy link
Contributor

@ashu-mehra ashu-mehra left a comment

Choose a reason for hiding this comment

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

lgtm!

…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
Copy link
Contributor

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

Copy link
Contributor

@adinn adinn left a comment

Choose a reason for hiding this comment

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

This all looks good.

…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

I forgot to release my comment. You could hold the lock for the duration if you want.

Copy link
Contributor

@coleenp coleenp 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've always wondered if CDS could share these.

Copy link
Contributor

@rose00 rose00 left a comment

Choose a reason for hiding this comment

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

Good changes. One request: Please add a comment, if there isn't one somewhere already, saying (as an order of magnitude) what is a typical size of the MH intrinsic table. That would be an estimate of the number printed by this log message:

  log_info(cds)("Archived %d method handle intrinsics", len)

…-in-cds-archive-heap' into jep-483-step-05-8293337-archive-method-handle-intrinsics
@iklam
Copy link
Member Author

iklam commented Oct 22, 2024

Closing this PR as its changes have been combined into #21642.

@iklam iklam closed this Oct 22, 2024
@iklam
Copy link
Member Author

iklam commented Oct 22, 2024

Good changes. One request: Please add a comment, if there isn't one somewhere already, saying (as an order of magnitude) what is a typical size of the MH intrinsic table. That would be an estimate of the number printed by this log message:

  log_info(cds)("Archived %d method handle intrinsics", len)

I have added size statistics in the combined PR

https://github.com/openjdk/jdk/pull/21642/files#diff-ca37be6e6608d8db9e461dffd6574bc8a2dc3d1e0e88d9ba66735d4b37f8c226R377-R390

It looks like this:

[0.603s][info][cds] Archived 19 method handle intrinsics (5784 bytes)     <-- for HelloWorld
[1.696s][info][cds] Archived 61 method handle intrinsics (18552 bytes)    <-- for 'javac HelloWorld.java'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot hotspot-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

8 participants