On Fri, 13 Nov 2026 22:28:01 GMT, Xin Liu <[email protected]> wrote:

>> In special cases, an upcall could emerge from a new native thread. No prior 
>> Java frame is present. FFM upcall stub will attach to JVM and then back to 
>> the Java world.
>> 
>> This patch updates **find_initial_Java_frame()** of ASGCT. Like entry frame 
>> (JNI's upcall), it detects the upcall stub (FFM upcall) which is the first 
>> Java frame. If so, stop probing the initial Java frame and return false 
>> immediately. This fixes two cases in `forte_fill_call_trace_given_top()`:
>> 
>> 1. No initial java frame is found. Skip stackwalking because 
>> `initial_Java_frame.safe_for_sender()` is false.
>> 2. An initial frame is found. It's not the upcall stub frame, but a java 
>> callee. `vframeStreamCommon::fill_from_frame()` will encounter the upcall 
>> stub frame, set at_end_mode and terminate stackwalking.
>> 
>> This patch doesn't touch the loop under #ifdef ZERO. It is because there's 
>> no upcall stub in zero build. FFM will use FallbackLinker and entry_frame.
>> 
>> 
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Xin Liu has updated the pull request with a new target base due to a merge or 
> a rebase. The incremental webrev excludes the unrelated changes brought in by 
> the merge/rebase. The pull request contains two additional commits since the 
> last revision:
> 
>  - Merge branch 'openjdk:master' into JDK-8397000
>  - 8397000: find_initial_Java_frame should return false for the first frame 
> of upcall
>    
>    In special cases, an upcall emerges from a new native thread. No prior java
>    frame is present. FFM upcall stub will attach to JVM and then back to the 
> Java
>    world.
>    
>    This patch updates find_initial_Java_frame() of ASGCT. Like entry frame 
> (JNI's
>    upcall), it detects the upcall stub (FFM upcall) which is the 1st Java 
> frame.
>    If so, stop probing the initial Java frame and return false immediately. 
> This
>    fixes two cases in forte_fill_call_trace_given_top():
>    
>    1. No initial java frame is found. Skip stackwalking because
>       initial_Java_frame.safe_for_sender() is false.
>    2. An initial frame is found. It's not the upcall stub frame, but a java 
> callee.
>       vframeStreamCommon::fill_from_frame() will encounter the upcall stub 
> frame,
>       set at_end_mode and terminate stackwalking.
>    
>    This patch doesn't touch the loop under #ifdef ZERO. It is because there's 
> no
>    upcall stub in zero build. FFM will use FallbackLinker and entry_frame.

Can you add the test which get stacktrace from method with upcall.

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

PR Comment: https://git.openjdk.org/jdk/pull/33832#issuecomment-6872190200

Reply via email to