RFR: 8299414: JVMTI FollowReferences should support references from VirtualThread stack [v16]
Serguei Spitsyn
sspitsyn at openjdk.org
Sat May 6 09:16:21 UTC 2023
On Fri, 5 May 2023 23:03:38 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
>> The fix updates JVMTI FollowReferences implementation to report references from virtual threads:
>> - unmounted vthreads are detected, their stack references for JVMTI_HEAP_REFERENCE_STACK_LOCAL/JVMTI_HEAP_REFERENCE_JNI_LOCAL;
>> - stacks of mounted vthreads are splitted into 2 parts (virtual thread stack and carrier thread stack), references are reported with correct thread id/class tag/object tags/frame depth;
>> - common code to handle stack frames are moved into separate class;
>>
>> Threads are reported as:
>> - platform threads: JVMTI_HEAP_REFERENCE_THREAD (as before);
>> - mounted vthreads (synthetic references, consider them as heap roots because carrier threads are roots): JVMTI_HEAP_REFERENCE_OTHER;
>> - unmounted vthreads: not reported as heap roots.
>
> Alex Menkov has updated the pull request incrementally with three additional commits since the last revision:
>
> - cosmetic changes in libVThreadStackRefTest.cpp
> - collect VT stack references if initial_object is null
> - moved transition disabler to correct functions
test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp line 140:
> 138: LOG("JVMTI FollowReferences error: %d\n", err);
> 139: env->FatalError("FollowReferences failed");
> 140: }
Nit: `classesCount` and `heapCallBacks` need c-style names.
test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp line 153:
> 151: }
> 152:
> 153: static void printCreatedClass(JNIEnv* env, jclass cls) {
Nit: This function should have a c-style name.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1186668539
PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1186668689
More information about the hotspot-dev
mailing list