On Tue, 28 Apr 2026 23:05:30 GMT, Serguei Spitsyn <[email protected]> wrote:

>> This enhancement is to a add JVMTI debugging support for value object 
>> construction.
>> The fix includes:
>>  - Minor `GetLocalObject` and `GetLocalInstance` spec clarifications
>>  - JVMTI functions `GetLocalObject` and `GetLocalInstance` now return a 
>> snapshot of the `THIS` object if it is requested during a value object 
>> construction.
>>  - This update adds new test with a needed test coverage: 
>> `test/hotspot/jtreg/serviceability/jvmti/valhalla/GetCtorLocal`.
>>  - Some corrections in the test 
>> `test/hotspot/jtreg/serviceability/jvmti/valhalla/GetSetLocal` for 
>> unification with the test above.
>> 
>> Testing:
>>   - Tested locally with new test `GetCtorLocal`
>>   - Tested with 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 incrementally with one 
> additional commit since the last revision:
> 
>   review: a call to OrderAccess::storestore is added

src/hotspot/share/prims/jvmtiImpl.cpp line 503:

> 501:     // Must ensure the content of the buffered value is visible
> 502:     // before publishing the buffered value oop
> 503:     OrderAccess::storestore();  }

A storestore() seems necessary before publishing the jobject to other threads, 
if copy_to() is used.  But why can't we do this instead:

oop obj_copy = src.read(_calling_thread);
if (obj_copy == nullptr) {
  _result = JVMTI_ERROR_OUT_OF_MEMORY;
} else {
  _value.l = JNIHandles::make_local(_calling_thread, obj_copy);
}

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2363#discussion_r3157932713

Reply via email to