RFR: 8369609: Continuations preempt_epilog is missing a call to invalidate_jvmti_stack [v2]

Patricio Chilano Mateo pchilanomate at openjdk.org
Wed Oct 22 19:02:59 UTC 2025


On Wed, 22 Oct 2025 01:57:09 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> src/hotspot/share/runtime/continuationFreezeThaw.cpp line 1689:
>> 
>>> 1687:   log_develop_debug(continuations)("=== End of freeze cont ### #" INTPTR_FORMAT, cont.hash());
>>> 1688: 
>>> 1689:   JVMTI_ONLY(invalidate_jvmti_stack(JavaThread::current()));
>> 
>> Why not directly in `preempt_epilog`? Is it to cover the freeze fast case too? If that’s the case we should remove the call to `invalidate_jvmti_stack` from `jvmti_yield_cleanup` to avoid calling it twice for the freeze slow case. Also I wonder if this call to `invalidate_jvmti_stack` should just be moved to `JvmtiVTMSTransitionDisabler::VTMS_unmount_end` instead.
>
> Thank you for the comment! Yes, I had in mind but forgot to remove the call to `invalidate_jvmti_stack()` from `jvmti_yield_cleanup()`. I've pushed the update now.
> 
>> Also I wonder if this call to invalidate_jvmti_stack should just be moved to JvmtiVTMSTransitionDisabler::VTMS_unmount_end instead.
> 
> Unfortunately, this is not going to work for plain/pure continuations as `mount/unmount` code path does not work for them.

I see. What do you think about adding `invalidate_jvmti_stack` in `jvmti_yield_cleanup` if `!cont.entry()->is_virtual_thread()` is true to address that case?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27878#discussion_r2453080175


More information about the hotspot-runtime-dev mailing list