Skip to content

8363846: [lworld] Make Class.isIdentityClass() non-native #1514

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

Closed
wants to merge 9 commits into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Jul 22, 2025

This moves isIdentityClass() implementation to Class.java, and checks within the JVM that is_identity_class() doesn't check the access flags for an ArrayKlass, since AccessFlags aren't initialized in ArrayKlasses. The AccessFlags should be moved from Klass.hpp to InstanceKlass.cpp in mainline but that's a more complicated change and has several pieces.
Added a test.
Tested with tier1 locally.


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8363846: [lworld] Make Class.isIdentityClass() non-native (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1514

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1514.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 22, 2025

👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into lworld 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 22, 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:

8363846: [lworld] Make Class.isIdentityClass() non-native

Reviewed-by: liach, rriggs

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 3 new commits pushed to the lworld branch:

  • 3626f88: 8361307: [lworld] Clarify identity vs value in Class, Objects, and document limitations of value objects
  • 1fdd381: 8363956: [lworld] Valhalla vauetypes tests enablePreview should be per test
  • d1c3062: 8349110: [lworld] Intrinsics for Unsafe.get/putFlatValue

Please see this link for an up-to-date comparison between the source branch of this pull request and the lworld 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 lworld branch, type /integrate in a new comment.

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 22, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 22, 2025

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.

is_identity_class seems widely used in many areas, such as C2 - do we need to verify those usages?

@coleenp
Copy link
Contributor Author

coleenp commented Jul 23, 2025

is_identity_class seems widely used in many areas, such as C2 - do we need to verify those usages?

Good question. I did check most/attempted all of these places and added the assert in klass.hpp but since AccessFlags are in klass, it is possible to copy them from an ArrayKlass to a ciKlass and fail the is_identity check for an array. The only way to make this completely safe is to move the access flags, which I started in another repo but it's got pretty hairy since Klass and InstanceKlass are used interchangeably in some of the compiler code that I don't know very well, when I think they really mean InstanceKlass.

Copy link
Collaborator

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

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

For new tests we use junit.
See other tests like UseValueClassTest for imports and per test annotations.

Copy link
Collaborator

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

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

The test looks good, the conditions are more complicated than is obvious because with --enable-preview new modifier bits are defined with new used.
Thanks for the updates.

Copy link
Collaborator

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

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

Look good, thanks

* @library /test/lib
* @enablePreview false
* @modules java.base/jdk.internal.misc
* java.base/jdk.internal.value
Copy link
Member

Choose a reason for hiding this comment

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

TEST.properties is updated; we might remove these directives.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I can't merge right now with the latest to test.

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 redundant directives in tests are fine.

@coleenp
Copy link
Contributor Author

coleenp commented Jul 24, 2025

Thank you for all your help with this test, Roger and Chen.
/integrate

@openjdk
Copy link

openjdk bot commented Jul 24, 2025

Going to push as commit acfb4f0.
Since your change was applied there have been 3 commits pushed to the lworld branch:

  • 3626f88: 8361307: [lworld] Clarify identity vs value in Class, Objects, and document limitations of value objects
  • 1fdd381: 8363956: [lworld] Valhalla vauetypes tests enablePreview should be per test
  • d1c3062: 8349110: [lworld] Intrinsics for Unsafe.get/putFlatValue

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 24, 2025

@coleenp Pushed as commit acfb4f0.

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

@coleenp coleenp deleted the isid2 branch July 24, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants