RFR: 8365192: post_meth_exit should be in vm state when calling get_jvmti_thread_state [v4]
Serguei Spitsyn
sspitsyn at openjdk.org
Thu Aug 14 09:17:12 UTC 2025
On Thu, 14 Aug 2025 00:01:29 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:
>> Leonid Mesnik has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - added _
>> - wong phase
>
> src/hotspot/share/prims/jvmtiExport.cpp line 1838:
>
>> 1836: {
>> 1837: ThreadInVMfromJava tiv(thread);
>> 1838: state = get_jvmti_thread_state(thread);
>
> The issue I see is that `get_jvmti_thread_state()` can safepoint for virtual threads (and now also for platform threads because of `~ThreadInVMfromJava`), which brings us back to the bug 8255452 was trying to fix: if there is a return oop at the top of the stack, it could become invalid if a GC occurs. I think we will have to unconditionally save the return value in case it's an oop, before doing anything else.
Thank you, Patricio! Good catch and suggestion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26713#discussion_r2276043185
More information about the serviceability-dev
mailing list