RFR: 8350106: [PPC] Avoid ticks_unknown_not_Java AsyncGetCallTrace() if JavaFrameAnchor::_last_Java_pc not set
Martin Doerr
mdoerr at openjdk.org
Tue Feb 25 10:21:03 UTC 2025
On Fri, 14 Feb 2025 16:11:05 GMT, Richard Reingruber <rrich at openjdk.org> wrote:
> This pr changes `JavaThread::pd_get_top_frame_for_profiling` to better address situations where
>
> 1. `JavaThread::last_Java_sp()` returns != null
> 2. `JavaThread::last_Java_pc()` returns null
>
> If the runtime needs to walk the stack of a java thread in that state, e.g. for gc purposes, it finds the last java pc relative to the last java sp (see [frame::setup()](https://github.com/openjdk/jdk/blob/3f0c1370269db978072814c2170fc3987efade85/src/hotspot/cpu/ppc/frame_ppc.inline.hpp#L40)).
>
> This relies on the runtime method being called to store the return pc to its caller's abi which it will do when pushing a new frame for calling another method.
>
> For an asynchronous interrupt to sample the stack this means: if there isn't at least one frame between the last java frame and the frame where the interrupt occurred then we can't be sure that the return pc was already saved and `pd_get_top_frame_for_profiling()` needs to return false indicating failure.
>
> Otherwise we can and should proceed constructing a frame even though `JavaThread::last_Java_pc()` returned null.
>
> Testing:
>
> * DaCapo Tomcat with async-profiler on a fastdebug build.
> * Tier 1-4 of hotspot and jdk on the main platforms and also on Linux/PPC64le and AIX.
Nice enhancement to get more samples! LGTM.
-------------
Marked as reviewed by mdoerr (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/23640#pullrequestreview-2640504700
More information about the hotspot-runtime-dev
mailing list