On Thu, 22 Jan 2026 02:35:39 GMT, Chris Plummer <[email protected]> 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

Reply via email to