Skip to content

Conversation

@alexmenkov
Copy link

@alexmenkov alexmenkov commented Dec 18, 2025

Updated implementation of ObjectReference.equals and ObjectReference.hashCode to comply the spec for value objects.
Added the test for value object ctor debugging, the test verifies the behaviour is expected.
There is an issue with instance filter, it till be fixed separately (it's not yet clear how it would be better to fix it)

testing: tier1..4, hs-tier5-svc


Progress

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

Issue

  • JDK-8373202: [lworld] ObjectReference.equals should follow == semantics for value objects (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1834

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@alexmenkov alexmenkov marked this pull request as draft December 18, 2025 20:00
@bridgekeeper
Copy link

bridgekeeper bot commented Dec 18, 2025

👋 Welcome back amenkov! 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 Dec 18, 2025

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

8373202: [lworld] ObjectReference.equals should follow == semantics for value objects

Reviewed-by: sspitsyn

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 269 new commits pushed to 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
Copy link

openjdk bot commented Jan 10, 2026

⚠️ @alexmenkov This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@alexmenkov alexmenkov changed the title Ctor debug 8373202: [lworld] ObjectReference.equals should follow == semantics for value objects Jan 12, 2026
@alexmenkov alexmenkov marked this pull request as ready for review January 12, 2026 21:49
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 12, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 12, 2026

Webrevs

}

public boolean canUseIsSameObject() {
public boolean supportsValueClasses() {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if not running in preview mode? Value classes are not supported in that case, but as implemented this API will say they are supported, leading to isValueClass() looking at modifiers in a way that is not compatible when value classes are not supported.

JDI didn't really run into this type of problem with virtual thread support. It did modify a couple of new public APIs with:

@PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)

However, I don't see how that helps us here. It seems we need to query the debug agent to find out if value classes are supported. There's no good way to do that. Is there any way for JDI to somewhat detect that value class support is supported (preview mode is enabled).

Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if not running in preview mode? Value classes are not supported in that case, but as implemented this API will say they are supported, leading to isValueClass() looking at modifiers in a way that is not compatible when value classes are not supported.

It should work correctly. The IDENTITY modifier bit is not used for other purposes in JDK 27 (Alex, please, fix me if it is wrong). So, the check for version >= 27 is needed. If preview is not enabled in target VM, so it does not support value classes then the IDENTITY modifier bit will be always set which results in isValueClass() to always return false.

Copy link
Contributor

Choose a reason for hiding this comment

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

So in JDK 27, with or without enable preview, the IDENTITY modifier bit is accurate and can be looked at, but in previous JDK versions it might be used for something else?

Copy link
Author

Choose a reason for hiding this comment

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

So in JDK 27, with or without enable preview, the IDENTITY modifier bit is accurate and can be looked at, but in previous JDK versions it might be used for something else?

Correct

@sspitsyn
Copy link
Contributor

sspitsyn commented Jan 23, 2026

testing: tier1..4, hs-tier5-svc

I'd suggest to run mach5 full tier-5 and tier-6 as well.

@alexmenkov
Copy link
Author

testing: tier1..4, hs-tier5-svc

I'd suggest to run mach5 full tier-5 and tier-6 as well.

in progress

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

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

Thank you for updates! It looks good to me.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants