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).

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

Commit messages:
 - 8397000: find_initial_Java_frame should return false for the first frame of 
upcall

Changes: https://git.openjdk.org/jdk/pull/33832/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33832&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8397000
  Stats: 9 lines in 1 file changed: 9 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/33832.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33832/head:pull/33832

PR: https://git.openjdk.org/jdk/pull/33832

Reply via email to