On Fri, 10 Jul 2026 09:11:29 GMT, Serguei Spitsyn <[email protected]> wrote:
>> src/hotspot/share/prims/jvmti.xml line 937:
>>
>>> 935: and
>>> 936: <externallink
>>> id="jni/functions.html#newweakglobalref"><code>NewWeakGlobalRef</code></externallink>,
>>> 937: specify the JNI behavior for value objects. Any additional
>>> JVMTI-specific behavior
>>
>> I don't think we need to say all this. It really isn't for the JVMTI spec to
>> state where the JNI spec may treat objects with/without identity
>> differently, and individual JVMTI methods that behave differently already
>> state that you can use `HasIdentity` to query that. I would keep this very
>> succinct as I did for the JNI spec itself:
>>> If preview features are enabled then some Java objects will have identity
>>> and others (instances of value classes) will not. The JNI makes no
>>> distinction between these cases in the general programming model, but some
>>> specific functions will behave differently if invoked upon a Java object
>>> that does not have identity.
>>
>> So for JVMTI then something like:
>>> If preview features are enabled then some Java objects will have identity
>>> and others (instances of value classes) will not. `<jvmti/>` makes no
>>> distinction between these cases in general, but some specific functions
>>> will behave differently if invoked upon a Java object that does not have
>>> identity.
>
> Thanks, David. Updated as you suggested.
Joe is also suggesting to summarize the value objects impact on JVMTI functions
and events. I'm thinking if the following would be good to add:
diff --git a/src/hotspot/share/prims/jvmti.xml
b/src/hotspot/share/prims/jvmti.xml
index cbdecfc1cb1..33202ac6b5d 100644
--- a/src/hotspot/share/prims/jvmti.xml
+++ b/src/hotspot/share/prims/jvmti.xml
@@ -930,6 +930,16 @@ Agent_OnUnload_L(JavaVM *vm)</example>
(instances of value classes) will not. <jvmti/> makes no distinction
between these cases
in general, but some specific functions will behave differently if invoked
upon
a Java object that does not have identity.
+ <p/>
+ Value objects can be tagged. Tags for value objects follow value equality
+ semantics, and tagged value objects are kept alive while tagged. The
+ <eventlink id="ObjectFree"/> event is not sent for tagged value objects.
+ <p/>
+ Value objects also affect allocation events, including
+ <eventlink id="VMObjectAlloc"/> and <eventlink id="SampledObjectAlloc"/>,
+ and functions related to value object constructor frames, including
+ <functionlink id="GetLocalInstance"/>, <functionlink id="GetLocalObject"/>,
+ and <functionlink id="ForceEarlyReturnVoid"/>.
</intro>
<functionsection label="Functions">
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2634#discussion_r3558217511