Skip to content

Conversation

@coleenp
Copy link
Contributor

@coleenp coleenp commented Sep 15, 2025

This change removes the optimization to not store abstract and interface Klass metadata to non-class metaspace. Now all Klass metadata is in the Klass metaspace. This is simpler and less bug prone, and didn't help with the limitation of classes that can be stored in class metaspace materially.
Tested with tier1-4.


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-8365823: Revert storing abstract and interface Klasses to non-class metaspace (Enhancement - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27295

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@coleenp
Copy link
Contributor Author

coleenp commented Sep 15, 2025

/label assign @shipilev
to review.

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 15, 2025

👋 Welcome back coleenp! 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 Sep 15, 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:

8365823: Revert storing abstract and interface Klasses to non-class metaspace

Reviewed-by: kvn, shade, stuefe

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 86 new commits pushed to the master 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 master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Sep 15, 2025

@coleenp
The label assign is not a valid label.
The label @shipilev is not a valid label.
These labels are valid:

  • graal
  • serviceability
  • hotspot
  • hotspot-compiler
  • ide-support
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • security
  • hotspot-runtime
  • jmx
  • build
  • nio
  • client
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr

@openjdk
Copy link

openjdk bot commented Sep 15, 2025

@coleenp The following labels will be automatically applied to this pull request:

  • graal
  • hotspot

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.

@openjdk openjdk bot added graal graal-dev@openjdk.org hotspot hotspot-dev@openjdk.org rfr Pull request is ready for review labels Sep 15, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 15, 2025

Webrevs

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

First pass comments below.

Also, I looked at original change, and I wonder if we want to revert other changes as well. It looks to me they are fairly innocuous, TBH, so I have no strong opinion about them.

  1. Changing final -> abstract in InvokerBytecodeGenerator: ad10493?diff=unified#diff-3b05b61400e7766115409b3f508d839fb51e450423822252ab2e18543427c764L249-R249 Reverted already with JDK-8341649.

  2. JFR: ad10493?diff=unified#diff-d58d6d9783cb29084a15c42ecd7f59860a48be8bcfd9be0ee15a9d50209b576fR1-R160

  3. Test: ad10493?diff=unified#diff-00138acd973f46c5f91674e5388ee82d2e7ed1b788ed551f34120cc761d228b7L1-R166

@liach
Copy link
Member

liach commented Sep 15, 2025

Re InvokerBytecodeGenerator: it was rolled back almost immediately after the original patch due to performance regressions.

coleenp and others added 3 commits September 15, 2025 14:30
Co-authored-by: Aleksey Shipilëv <shipilev@amazon.de>
Co-authored-by: Aleksey Shipilëv <shipilev@amazon.de>
@coleenp
Copy link
Contributor Author

coleenp commented Sep 15, 2025

The JFR changes were a slight refactoring, so I don't think they need to be changed back. The ClassFileParser.is_abstract() function is now unused. Well spoltted.

Copy link
Member

@shipilev shipilev 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 to me, I have a few more questions:

MetaspaceObj::Type type, TRAPS) throw() {
// Klass has its own operator new
assert(type != ClassType, "class has its own operator new");
return Metaspace::allocate(loader_data, word_size, type, /*use_class_space*/ false, THREAD);
Copy link
Member

Choose a reason for hiding this comment

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

Question: now that ArrayKlass and InstanceKlass do not have ::new, the assert above is still valid? I am guessing all these inherit Klass::new?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, all Klass allocation should call Klass::operator new(). Klass is derived from Metadata that's derived from MetaspaceObj. The Klass operator new hides the one in MetaspaceObj.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 15, 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.

Good.

This is not 1-to-1 back-out of #19157 . I assume it is because there were several additional follow up fixes.

Will 25u backport be the same?

@coleenp
Copy link
Contributor Author

coleenp commented Sep 17, 2025

Yes, this wasn't just a backout. I stayed away from the JFR code refactoring, and there were other fixes for hidden classes that are already in JDK 25. And we added then backported a diagnostic flag, that this change removes.

@coleenp
Copy link
Contributor Author

coleenp commented Sep 17, 2025

Yes, this change should backport cleanly to JDK 25 pending approval.
Thanks for reviewing Aleksey and Vladimir.

Copy link
Member

@tstuefe tstuefe 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. In hindsight kind of scary that there are no tests to change back. But all Metaspace tests sit either on a layer below Metaspace::allocate or test class loading, which sits above this layer.

Some tests that check expected memory levels in class space and non-class metaspace could now run into problems, since the ratio between these numbers should shift (total consumption should be about identical). Maybe not. We'll see it when we see it.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 18, 2025
Copy link

@mgronlun mgronlun left a comment

Choose a reason for hiding this comment

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

Commit: "Revert JFR changes from JDK-8338526 also." looks good.

Thanks

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.

Still good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 18, 2025
@coleenp
Copy link
Contributor Author

coleenp commented Sep 19, 2025

Thanks Vladimir for re-reviewing.
/integrate

@openjdk
Copy link

openjdk bot commented Sep 19, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 19, 2025

@coleenp Pushed as commit fa00b24.

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

@coleenp coleenp deleted the undo-klass branch September 19, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

graal graal-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

6 participants