Skip to content

Update nmethod caching and clean up unused/duplicate methods #71

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

Open
wants to merge 12 commits into
base: premain
Choose a base branch
from

Conversation

ashu-mehra
Copy link
Collaborator

@ashu-mehra ashu-mehra commented Jun 2, 2025

This PR updates nmethod caching to be based on caching of CodeBlob. It also cleans up some dead code and duplicate methods.


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 71

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/leyden/pull/71.diff

Using Webrev

Link to Webrev Comment

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
@bridgekeeper
Copy link

bridgekeeper bot commented Jun 2, 2025

👋 Welcome back asmehra! A progress list of the required criteria for merging this PR into premain 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 Jun 2, 2025

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

@ashu-mehra
Copy link
Collaborator Author

@vnkozlov @adinn please review.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 2, 2025
@mlbridge
Copy link

mlbridge bot commented Jun 2, 2025

Webrevs

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
strings

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Comment on lines 106 to 107
uint _blob_offset; // Start of archived blob in the cache
uint _code_offset; // Start of code for an entry of type "Stub"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why you need 2 different fields for offset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did this only for the clarity - using _blob_offset is for storing Stubs doesn't sound correct, so I added _code_offset for the Stubs. If it is confusing, I can keep _blob_offset and remove the _code_offset field.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest to use old _code_ofset for now. As we discussed on meeting we will need separate _metadata_offset to move all data describing code so we can map whole section of codes directly into CodeCache.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or we can compromise: _codeblob_offset, _codeblob_size
Stubs are also using CodeBlob. I don't get why you treat stubs differently.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

StubGenerator Stubs used CodeBlob, but in AOT CodeCache we don't store their CodeBlobs as we do for adapters/runtime blobs. We instead only copy the assembly code for each stub.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't yet store a blob because we are just archiving a couple of special case stubs. But when we rework multi-stub save and restore for each of the stubgen stub groups (initial, cont, etc) then we should probably store/retrieve the code for all stubs in a group as a complete blob.

n.b. I say probably because we have to think about the case where we have errors loading code for a given stubgen blob or where the stubs we need at runtime include code that was not embedded in the saved blob at assembly time (i.e. because of changes on the command line). In the former case we would have to invalidate the loaded blob and recreate a new blob. In the latter we would have to generate missing code into a code buffer and create a secondary blob after we finish loading+generating.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For now I agree with Vladimir - just use code_offset and code_size.

@vnkozlov
Copy link
Collaborator

vnkozlov commented Jun 4, 2025

Before I start testing and approve it I think we should wait your fix JDK-8358330 integration (my testing is still running) and then merge from mainline to premain.

_loaded = false;
_not_entrant = false;
_load_fail = false;
_ignore_decompile = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This leaves field _ignore_decompile uninitialized. Should you be setting it to false here?

Comment on lines 106 to 107
uint _blob_offset; // Start of archived blob in the cache
uint _code_offset; // Start of code for an entry of type "Stub"
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't yet store a blob because we are just archiving a couple of special case stubs. But when we rework multi-stub save and restore for each of the stubgen stub groups (initial, cont, etc) then we should probably store/retrieve the code for all stubs in a group as a complete blob.

n.b. I say probably because we have to think about the case where we have errors loading code for a given stubgen blob or where the stubs we need at runtime include code that was not embedded in the saved blob at assembly time (i.e. because of changes on the command line). In the former case we would have to invalidate the loaded blob and recreate a new blob. In the latter we would have to generate missing code into a code buffer and create a secondary blob after we finish loading+generating.

Comment on lines 106 to 107
uint _blob_offset; // Start of archived blob in the cache
uint _code_offset; // Start of code for an entry of type "Stub"
Copy link
Collaborator

Choose a reason for hiding this comment

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

For now I agree with Vladimir - just use code_offset and code_size.

@shipilev
Copy link
Member

shipilev commented Jun 5, 2025

I wonder if both #75 and #76 preclude properly testing this PR. Let's integrate those first too.

@vnkozlov
Copy link
Collaborator

vnkozlov commented Jun 5, 2025

I wonder if both #75 and #76 preclude properly testing this PR. Let's integrate those first too.

Yes, and merge from mainline with all AOT bugs fixes there. I will wait JDK 25 fork before merge.

@vnkozlov
Copy link
Collaborator

vnkozlov commented Jun 5, 2025

And we need to fix bootstrap sequence: JDK-8358690 and #75

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
…alled before their destructor

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants