RFR: 8350106: [PPC] Avoid ticks_unknown_not_Java AsyncGetCallTrace() if JavaFrameAnchor::_last_Java_pc not set [v2]

Richard Reingruber rrich at openjdk.org
Tue Mar 11 15:58:05 UTC 2025


On Mon, 10 Mar 2025 15:19:41 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.
>
> Richard Reingruber 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 'master'
>  - Better handle _last_Java_pc == null

Test failure on aarch64 is unrelated.
Thanks for the review Martin.

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

PR Comment: https://git.openjdk.org/jdk/pull/23640#issuecomment-2714862546


More information about the hotspot-runtime-dev mailing list