RFR(s): 8223313: Use handshakes for CountStackFrames.

Robbin Ehn robbin.ehn at oracle.com
Tue May 21 08:44:13 UTC 2019


Hi Dan,

> 
> So a very long way of saying: Thumbs up!

Thanks!

/Robbin

> 
> Dan
> 
> 
> A bit more commentary:
> 
> https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/Thread.html#countStackFrames() 
> 
>      countStackFrames() is not only deprecated, but it is deprecated for
>      removal. That's the really good news here! However, deprecation does
>      not mean that the API cannot be used. It means we recommend that you
>      don't use it and if you have issues with the API, then we'll remind
>      you that it is deprecated and you should not use it.
> 
> And a clarification:
>      The reason for the "is_thread_fully_suspended(true," call is
>      that a call to SuspendThread() will return to the caller once
>      an external suspend is requested. The target thread does not
>      have to have completed the self-suspension, but it does have
>      to not execute any more bytecode or bytecode equivalents.
> 
>      So this sequence:
> 
>          SuspendThread(target);
>          CountStackFrames(target);
> 
>      requires that CountStackFrames() wait for target's stack to
>      be safe to walk. In the cooperative self-suspension world,
>      that means waiting for the suspend request to be complete.
>      Without "is_thread_fully_suspended(true," (in the current
>      system), it is possible for CountStackFrames() to crash
>      even without a rogue resume.
> 
>>
>> The only test using this seems to be CountStackFramesAtExit.java which passes 
>> fine.
>>
>> Thanks, Robbin
> 


More information about the hotspot-runtime-dev mailing list