Skip to content

Conversation

iklam
Copy link
Member

@iklam iklam commented Aug 30, 2025

This PR is one (of many) steps in JDK-8366473 (Refactor CDS source code with new AOT terminology):

Rename is_shared() in Metaspace (and various other classes) to in_aot_cache() to reflect its true meaning:

  • tests if an object is inside the AOT cache's metaspace region.

Also various forms of "shared metaspace" are updated to "aot metaspace"

Please start your review with allocations.hpp


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-8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache() (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27016

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2025

👋 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
Copy link

openjdk bot commented Aug 30, 2025

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

8366474: Rename MetaspaceObj::is_shared() to MetaspaceObj::in_aot_cache()

Reviewed-by: liach, kvn

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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
Copy link

openjdk bot commented Aug 30, 2025

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

@mlbridge
Copy link

mlbridge bot commented Aug 30, 2025

Webrevs

@@ -35,7 +35,7 @@
//
// Also, this is a C header file. Do not use C++ here.

#define NUM_CDS_REGIONS 5 // this must be the same as MetaspaceShared::n_regions
#define NUM_CDS_REGIONS 5 // this must be the same as AOTMetaspace::n_regions
Copy link
Contributor

Choose a reason for hiding this comment

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

This file changes seems belong to your other RFE JDK-8366475.

Copy link
Contributor

Choose a reason for hiding this comment

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

But I am fine to have it here - it is only in comments.

System.out.println("MetaspaceShared::core_region_alignment() = " + reserve_alignment);
System.out.println("AOTMetaspace::core_region_alignment() = " + reserve_alignment);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too.

Copy link
Member Author

@iklam iklam Aug 30, 2025

Choose a reason for hiding this comment

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

I removed these changes and re-applied them in #27017 .

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.

Good. In few places you used AOTMetaspace in comments and messages. But I think it is fine. I assume you push this first.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 30, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Aug 30, 2025
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.

Update is good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 30, 2025
@dholmes-ora
Copy link
Member

Maybe the JBS title should be a bit more generic as you seem to be renaming many occurrences of "shared" not just the one listed.

@iklam
Copy link
Member Author

iklam commented Sep 2, 2025

Maybe the JBS title should be a bit more generic as you seem to be renaming many occurrences of "shared" not just the one listed.

The majority of the changes are about is_shared -> in_aot_cache. There are other changes like _shared_metaspace_static_top -> _aot_metaspace_static_top, but these are just implementation details.

This PR is one of the (many) subtasks for the "CDS" -> "AOT" renaming (main issue is JDK-8366473). My plan is to name each subtask to indicate its main purpose. Otherwise it will be difficult to be both precise and concise in the JBS title.

  • I.e., in this step I renamed some "shared" but left others, so I can't precisely describe that without writing a long essay.
  • If I used a generic title then it's difficult to tell the difference with other subtasks.

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

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

This rename is absolutely clarifying. Did not review the technical aspects of hotspot.

@openjdk
Copy link

openjdk bot commented Sep 4, 2025

@iklam this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout 8366474-rename_metaspaceobj_is_shared_to_in_aot_cache
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed ready Pull request is ready to be integrated labels Sep 4, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Sep 4, 2025
@iklam
Copy link
Member Author

iklam commented Sep 4, 2025

I've merged with the mainline to resolve conflicts.

I also made one extra fix: ConstantPool::is_shared() was shadowing MetaspaceObj::is_shared(), so I renamed it to in_aot_cache(), so that it will now shadow MetaspaceObj::in_aot_cache(). See 17f8c0b

@vnkozlov @liach could you re-review?

Copy link
Member

@liach liach left a comment

Choose a reason for hiding this comment

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

The subsequent fix looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 4, 2025
@iklam
Copy link
Member Author

iklam commented Sep 4, 2025

Thanks @vnkozlov @liach for the review
/integrate

@openjdk
Copy link

openjdk bot commented Sep 4, 2025

Going to push as commit 90a2db1.
Since your change was applied there has been 1 commit pushed to the master branch:

  • 4d1dfab: 8366038: Thread::SpinRelease should use Atomic::release_store

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 4, 2025

@iklam Pushed as commit 90a2db1.

💡 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
Development

Successfully merging this pull request may close these issues.

4 participants