[lworld] RFR: 8373202: [lworld] ObjectReference.equals should follow == semantics for value objects [v4]
Alex Menkov
amenkov at openjdk.org
Thu Jan 22 21:50:32 UTC 2026
On Thu, 22 Jan 2026 02:35:39 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> We had a private discussion with Alex on this before you've added this comment. The `canUseIsSameObject()` or its equivalent is needed to make sure the Hotspot version is >= 27. The bit `(modifiers & VMModifiers.IDENTITY)` is reused by the Valhalla in jdk 27 preview. In `jdk versions < 27` this bit was used for different purposes.
>
> Ok, so isValueClass() should check the JDK version, but I don't think we need checks for the availability of IsSameObject or ObjectHashCode because they won't end up being used if the JVM does not support value classes because isValueClass() will always return false in that case. This is true even with JDK 27 when not using --enable-preview. We may also want to have the debug agent return an error if IsSameObject or ObjectHashCode are called and the JVM is not being run with --enable-preview.
ok, added `VirtualMachineImpl.supportsValueClasses()` which indicates that a class can be value class and that `IsSameObject` and `ObjectHashCode` commands are available
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1834#discussion_r2718752556
More information about the valhalla-dev
mailing list