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

Serguei Spitsyn sspitsyn at openjdk.org
Thu Jan 22 02:06:50 UTC 2026


On Wed, 21 Jan 2026 04:40:12 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> src/jdk.jdi/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java line 170:
>> 
>>> 168:                     throw exc.toJDIException();
>>> 169:                 }
>>> 170:             }
>> 
>> Nit: The lines 164, 177 can be simplified a little bit with move of the renamed `vm.canUseIsSameObject()` check equivalent to the `isValueClass()`.
>
> If Valhalla is not supported on the target VM, there is no way for isValueClass() or isValueObject() to ever return true. If Valhalla is supported, they can return true, and we have to assume that JDWP and the debug agent support Valhalla also. We can't have Valhalla support in the JVM and not also have it in JDWP and the debug agent. The debugger/JDI will break if isValueObject() returns false for a value object.

We had a private discussion with Alex on this. The `canUseIsSameObject()` 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. The bit was used for different purposes in `jdk versions < 27`.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1834#discussion_r2715033620


More information about the valhalla-dev mailing list