On Wed, 6 May 2026 10:02:32 GMT, Serguei Spitsyn <[email protected]> wrote:

>> This PR implements two JVMTI enhancements: 
>> [8382702](https://bugs.openjdk.org/browse/JDK-8382702) and 
>> [8381063](https://bugs.openjdk.org/browse/JDK-8381063)
>> 
>> The update includes the following changes:
>>  - add spec clarifications for `VMObjectAlloc` and `SampledObjectAlloc` 
>> related to value object allocations
>>  - pass `nullptr` for `jobject` parameter of `VMObjectAlloc` and 
>> `SampledObjectAlloc` event callbacks
>>  - add test coverage with value object allocations for both event callbacks
>> 
>> Testing:
>>  - Test locally with newly added tests
>>  - Run mach5 tiers 1-6
>>  
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Serguei Spitsyn has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains eight additional 
> commits since the last revision:
> 
>  - Merge
>  - review: minor spec tweaks
>  - review: minor test tweaks: more checks, remove unneded code, add a comment 
> with assumption
>  - review: use non-identity object instead of value object
>  - review: add explaining comment to new test
>  - fix build error in new test on Windows
>  - review: 1. minor tweaks for spec wording; 2. add note about preview 
> features
>  - 8382702: [lworld] Define VMObjectAlloc behavior for value objects

I wonder to what extent we should be replacing "value" with "non-identity". I 
noticed the JNI update did some cleanup in that regard, but technically it is 
only necessary for things the user is exposed to, not implementation or tests.

src/hotspot/share/prims/jvmti.xml line 13997:

> 13995:       for some or all of their methods can send this event.
> 13996:       When preview features are enabled and an allocated object has no 
> identity,
> 13997:       <code>null</code> is passed for the <paramlink 
> id="object"></paramlink> parameter.

Suggestion:

      When preview features are enabled and the allocated object has no 
identity,
      <code>null</code> is passed for the <paramlink id="object"></paramlink> 
parameter.

src/hotspot/share/prims/jvmti.xml line 14044:

> 14042:           <description>
> 14043:             JNI local reference to the object that was allocated.
> 14044:             Null when preview features are enabled and an allocated 
> object has no identity.

Suggestion:

            Null when preview features are enabled and the allocated object has 
no identity.

src/hotspot/share/prims/jvmti.xml line 14091:

> 14089:       <functionlink id="GetStackTrace"></functionlink>, a user can 
> track which objects were allocated from which
> 14090:       stack trace, and which are still live during the execution of 
> the program.
> 14091:       When preview features are enabled and an allocated object has no 
> identity,

Suggestion:

      When preview features are enabled and the allocated object has no 
identity,

src/hotspot/share/prims/jvmti.xml line 14118:

> 14116:         <description>
> 14117:           JNI local reference to the object that was allocated.
> 14118:           Null when preview features are enabled and an allocated 
> object has no identity.

Suggestion:

          Null when preview features are enabled and the allocated object has 
no identity.

src/hotspot/share/prims/jvmtiExport.cpp line 1140:

> 1138:  public:
> 1139:    JvmtiObjectAllocEventMark(JavaThread *thread, oop obj) : 
> JvmtiClassEventMark(thread, oop_to_klass(obj)) {
> 1140:      _jobj = obj->is_inline() ? nullptr : (jobject)to_jobject(obj); // 
> nullptr for value objects

Suggestion:

     _jobj = obj->is_inline() ? nullptr : (jobject)to_jobject(obj); // nullptr 
for non-identity objects

test/hotspot/jtreg/serviceability/jvmti/valhalla/SampledObjectAllocValue/libSampledObjectAllocValue.cpp
 line 49:

> 47: Java_SampledObjectAllocValue_enableEvents(JNIEnv* jni, jclass klass, 
> jthread thread, jclass tested_class) {
> 48:   if (events_counter != 0) {
> 49:     fatal(jni, "SampledObjectAlloc events counter shouldn be zero");

Suggestion:

    fatal(jni, "SampledObjectAlloc events counter should be zero");

test/hotspot/jtreg/serviceability/jvmti/valhalla/SampledObjectAllocValue/libSampledObjectAllocValue.cpp
 line 70:

> 68:   }
> 69:   if (!is_test_class(jvmti, jni, klass)) {
> 70:     return; // interested in tested value class only

Suggestion:

    return; // interested in tested non-identity class only

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

PR Review: 
https://git.openjdk.org/valhalla/pull/2386#pullrequestreview-4237447845
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2386#discussion_r3196834071
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2386#discussion_r3196835476
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2386#discussion_r3196838781
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2386#discussion_r3196838641
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2386#discussion_r3196848830
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2386#discussion_r3196852738
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2386#discussion_r3196858370

Reply via email to