8242427: JVMTI frame pop operations should use Thread-Local Handshakes

David Holmes david.holmes at oracle.com
Wed Aug 26 07:16:00 UTC 2020


Hi Yasumasa,

On 24/08/2020 12:40 pm, Yasumasa Suenaga wrote:
> Hi all,
> 
> I want to hear your opinions about the change for JDK-8242427.
> 
> I'm trying to migrate following operations to direct handshake.
> 
>      - VM_UpdateForPopTopFrame
>      - VM_SetFramePop
>      - VM_GetCurrentLocation
> 
> Some operations (VM_GetCurrentLocation and EnterInterpOnlyModeClosure) 
> might be called at safepoint, so I want to use 
> JavaThread::active_handshaker() in production VM to detect the process 
> is in direct handshake or not.
> 
> However this function is available in debug VM only, so I want to hear 
> the reason why it is for debug VM only, and there are no problem to use 
> it in production VM. Of course another solutions are welcome.

I don't think it should be necessary to use that function in general nor 
safe in general - the only safe thing you can do is check if the current 
thread is the target's active handshaker (via an assert). It is of no 
use to you to know that the target thread is involved in a handshake 
with a different thread for a different reason, as it can leave that 
handshake at any time and its stack will not be walkable. You must 
perform a handshake from the current thread to the target.

Cheers,
David
-----


> webrev is here. It passed jtreg tests (vmTestbase/nsk/{jdi,jdwp,jvmti} 
> serviceability/{jdwp,jvmti})
>    http://cr.openjdk.java.net/~ysuenaga/JDK-8242427/proposal/
> 
> 
> Thanks,
> 
> Yasumasa


More information about the serviceability-dev mailing list