RFR: 8299414: JVMTI FollowReferences should support references from VirtualThread stack [v18]
Serguei Spitsyn
sspitsyn at openjdk.org
Tue May 9 21:34:31 UTC 2023
On Mon, 8 May 2023 21:32:54 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 one additional commit since the last revision:
>
> report_java_stack_refs/report_native_stack_refs
src/hotspot/share/prims/jvmtiTagMap.cpp line 2785:
> 2783: // walks the stack of the thread, finds all references (locals
> 2784: // and JNI calls) and reports these as stack references
> 2785: inline bool VM_HeapWalkOperation::collect_stack_refs(JavaThread* java_thread,
It makes sense to refactor the body of the `collect_stack_refs` function by adding 2 functions:
- collect_virtual_thread_stack_refs
- collect_platform_thread_stack_refs
It looks like the same register map can be used for both.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13254#discussion_r1189153256
More information about the hotspot-dev
mailing list