Skip to content

Gate IDENTITY modifier on Valhalla preview features in native code#23286

Merged
keithc-ca merged 1 commit intoeclipse-openj9:masterfrom
konark2010:fix-for-failing-identity-test
Feb 4, 2026
Merged

Gate IDENTITY modifier on Valhalla preview features in native code#23286
keithc-ca merged 1 commit intoeclipse-openj9:masterfrom
konark2010:fix-for-failing-identity-test

Conversation

@konark2010
Copy link
Copy Markdown
Contributor

@konark2010 konark2010 commented Jan 29, 2026

Description:

  • Previously, the IDENTITY modifier was enforced in the Java implementation. This change moves the gate to the native implementation, ensuring that the JVM reports the IDENTITY class modifier only when Valhalla preview features are enabled at runtime.

What changed:

  • Native code now checks the Valhalla preview runtime flag before setting the IDENTITY modifier.
  • Fixed IsIdentityTest failures, including array classes.

Motivation:

  • To ensure JVM behavior is consistent with Valhalla design expectations.

Impact:

  • JVM correctness for identity/value type detection.
  • Test suite passes reliably.

@konark2010
Copy link
Copy Markdown
Contributor Author

@hangshao0 @theresa-m can you please review this

@konark2010 konark2010 force-pushed the fix-for-failing-identity-test branch from a57421e to 00d2a6e Compare January 29, 2026 21:34
@konark2010 konark2010 requested a review from keithc-ca January 29, 2026 21:34
@hangshao0 hangshao0 added comp:vm project:valhalla Used to track Project Valhalla related work labels Jan 30, 2026
@konark2010 konark2010 requested a review from dsouzai as a code owner February 2, 2026 18:00
Copy link
Copy Markdown
Contributor

@keithc-ca keithc-ca left a comment

Choose a reason for hiding this comment

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

Changes are also required in runtime/vm/FastJNI_java_lang_Class.cpp and runtime/vm/romclasses.c.

@keithc-ca
Copy link
Copy Markdown
Contributor

Please address all feedback, including #23286 (review), before requesting the next review.

@konark2010 konark2010 requested a review from keithc-ca February 2, 2026 21:36
@konark2010 konark2010 requested a review from keithc-ca February 2, 2026 22:26
@konark2010 konark2010 requested a review from keithc-ca February 2, 2026 22:39
@konark2010 konark2010 requested a review from keithc-ca February 2, 2026 22:44
@konark2010 konark2010 force-pushed the fix-for-failing-identity-test branch from 44721ba to 8d1b758 Compare February 2, 2026 22:49
@keithc-ca
Copy link
Copy Markdown
Contributor

keithc-ca commented Feb 2, 2026

Please update the commit message: This is more about correcting the behavior of the JVM than fixing a test. Yes, it's important that we address test failures, and it's reasonable to elaborate on that in the body of the commit message, but the summary line should be about what the change will do the the JVM. The title of the pull request and the description should be consistent with that updated commit message.

@konark2010 konark2010 force-pushed the fix-for-failing-identity-test branch from 8d1b758 to e5182bb Compare February 2, 2026 23:01
@keithc-ca
Copy link
Copy Markdown
Contributor

The title of the pull request and the description should be consistent with that updated commit message

Please also do that.

This change fixes JVM behavior related to the IDENTITY modifier.
The JVM should report the IDENTITY modifier only when Valhalla preview
features are enabled at runtime. The native implementation is updated
to check the preview runtime flag before reporting the modifier.
This change also fixes IsIdentityTest failures, including array cases.

Signed-off-by: Konark Shah <konarkshah2010@gmail.com>
@konark2010 konark2010 force-pushed the fix-for-failing-identity-test branch from e5182bb to c69772a Compare February 3, 2026 15:43
@keithc-ca
Copy link
Copy Markdown
Contributor

@dsouzai Can you review or recommend a reviewer for the JIT changes here?

@konark2010 konark2010 changed the title Fix IsIdentityClassTest for array IDENTITY modifiers Gate IDENTITY modifier on Valhalla preview features in native code Feb 3, 2026
@hangshao0 hangshao0 requested review from hzongaro and removed request for dsouzai February 3, 2026 19:21
@hangshao0
Copy link
Copy Markdown
Contributor

Added @hzongaro to review the JIT change.
FYI @a7ehuo

@hangshao0
Copy link
Copy Markdown
Contributor

In that case please double check that the valhalla functional and OpenJDK tests are all passing @konark2010.

Once double checked, please confirm if they are all passing.

@konark2010
Copy link
Copy Markdown
Contributor Author

In that case please double check that the valhalla functional and OpenJDK tests are all passing @konark2010.

Once double checked, please confirm if they are all passing.

yes am checking the functional tests and the OpenJDK test will update here once done

@github-project-automation github-project-automation bot moved this from TODO: VM to Needs review in Valhalla L-World Feb 3, 2026
@dsouzai
Copy link
Copy Markdown
Contributor

dsouzai commented Feb 3, 2026

@dsouzai Can you review or recommend a reviewer for the JIT changes here?

Yeah I think Annabelle and/or Henry are appropriate reviewers for this.

Copy link
Copy Markdown
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

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

I think the JIT compiler changes look correct. Thanks!

@keithc-ca
Copy link
Copy Markdown
Contributor

Jenkins test sanity.functional,extended xlinuxval jdknext

@konark2010
Copy link
Copy Markdown
Contributor Author

There is one of the functional test failing when I checked on my local, am fixing it, will update here once done

@github-project-automation github-project-automation bot moved this from Needs review to Reviewer approved in Valhalla L-World Feb 4, 2026
@keithc-ca
Copy link
Copy Markdown
Contributor

one functional test failing

Which test is that? None failed in the build I launched.

@konark2010
Copy link
Copy Markdown
Contributor Author

one functional test failing

Which test is that? None failed in the build I launched.

Yes, actually the one which failed was due to my Mac so that can be ignored, so functional tests are good

@konark2010
Copy link
Copy Markdown
Contributor Author

Also I confirmed the OPEN-JDK tests are passing here is the link to it https://hyc-runtimes-jenkins.swg-devops.com/job/Grinder/58045/ , so now the PR should be good to move ahead

@keithc-ca
Copy link
Copy Markdown
Contributor

@hangshao0 @theresa-m Could you please complete your reviews?

@konark2010 konark2010 requested a review from theresa-m February 4, 2026 20:55
} else {
rawModifiers &= Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED
/*[IF INLINE-TYPES]*/
| AccessFlag.IDENTITY.mask() | Modifier.STRICT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you intend to remove this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

keith asked me to remove this #23286 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes okay. I believe the other uses of Modifier.Strict should also be removed to clean up old code as well @keithc-ca ? That can be a seperete change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I pointed out that strict does not apply to types, only methods; see #23286 (comment).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sounds good.

@keithc-ca keithc-ca merged commit c6871e9 into eclipse-openj9:master Feb 4, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in Valhalla L-World Feb 4, 2026
@hangshao0
Copy link
Copy Markdown
Contributor

Class.isValue() may need to always return false if --enable-preview is off at runtime. This can also be done in the native code.

@konark2010 Could you look at this and open a PR if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:jit comp:vm project:valhalla Used to track Project Valhalla related work

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants