Skip to content

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Jul 25, 2025

See the bug for more investigation. I think the root cause is already fixed in one of the InstanceMirrorKlass iterators, but not in the other one. Additionally, only one iterator handles the hidden classes. Also, there is a stale comment about CMS that apparently prevents us from asserting is_primitive, which is not relevant anymore.

So this PR commons out the metadata handling on both iterators, which fixes the GenShen+CDS bug, likely fixes hidden classes bug somewhere, and prevents the omission like this from happening again.

Additional testing:

  • Linux x86_64 server fastdebug, Generational Shenandoah + CDS bugs are not reproducing now
  • Linux x86_64 server fastdebug, tier1
  • Linux x86_64 server fastdebug, all

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8364111: InstanceMirrorKlass iterators should handle CDS and hidden classes consistently (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26477

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 25, 2025

👋 Welcome back shade! 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 Jul 25, 2025

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

8364111: InstanceMirrorKlass iterators should handle CDS and hidden classes consistently

Reviewed-by: stuefe, ayang, coleenp

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 61 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 Jul 25, 2025

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

@shipilev shipilev marked this pull request as ready for review July 25, 2025 12:55
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 25, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 25, 2025

Webrevs

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 like a good cleanup but need someone who knows GC better to also review.

/reviewers add 2

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 25, 2025
@openjdk
Copy link

openjdk bot commented Jul 25, 2025

@coleenp Usage: /reviewers <n> [<role>] where <n> is the number of required reviewers. If role is set, the reviewers need to have that project role. If omitted, role defaults to authors.

@coleenp
Copy link
Contributor

coleenp commented Jul 25, 2025

/reviewers 2

@openjdk
Copy link

openjdk bot commented Jul 25, 2025

@coleenp
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

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

The new comment is a lot better, thanks.

@tstuefe
Copy link
Member

tstuefe commented Jul 29, 2025

I wondered briefly whether the allowance ("CLD = null is okay for newly-loaded classes") should be also made in

} else {
assert(AOTLinkedClassBulkLoader::is_pending_aot_linked_class(k), "sanity");
}

But since we now handle mirror->referee Klass correctly in IMK, this only path affects oop->its Klass, and no instances exist yet for that Klass, right?

@shipilev
Copy link
Member Author

I wondered briefly whether the allowance ("CLD = null is okay for newly-loaded classes") should be also made in

} else {
assert(AOTLinkedClassBulkLoader::is_pending_aot_linked_class(k), "sanity");
}

But since we now handle mirror->referee Klass correctly in IMK, this only path affects oop->its Klass, and no instances exist yet for that Klass, right?

ClaimMetadataVisitingOopIterateClosure::do_klass called from other places, not only IMK. So I believe those asserts could be reached through other means. What we handle here is only IMK.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 30, 2025
@shipilev
Copy link
Member Author

Thanks! If there are no more comments, I will integrate this soon.

@shipilev
Copy link
Member Author

There we go.

/integrate

@openjdk
Copy link

openjdk bot commented Jul 31, 2025

Going to push as commit ebb7f5d.
Since your change was applied there have been 75 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 Jul 31, 2025
@openjdk openjdk bot closed this Jul 31, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 31, 2025
@openjdk
Copy link

openjdk bot commented Jul 31, 2025

@shipilev Pushed as commit ebb7f5d.

💡 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
Labels
hotspot [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants