RFR: 8265218: trace_method_handle_stub fails to find calling frame on x86
Vladimir Ivanov
vlivanov at openjdk.java.net
Mon Apr 19 13:50:37 UTC 2021
On Sat, 17 Apr 2021 05:35:29 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> `trace_method_handle_stub` on x86 tries to dump the frame which initiated the tracing, but fails to find the proper frame when it is the immediate caller.
>>
>> The problem is `os::current_frame()` returns the caller (instead of the current frame as the name suggests) and then `os::get_sender_for_C_frame()` steps over one more frame. So, if there are no intermediate frames present, it steps over the desired frame.
>>
>> Proposed fix is to start the search from the frame reported by `os::current_frame()`.
>>
>> Testing:
>> - [x] failing test
>> - [x] hs-precheckin-comp,hs-tier1,hs-tier2 w/ `-Xlog:methodhandles=trace`
>
> src/hotspot/cpu/x86/methodHandles_x86.cpp line 558:
>
>> 556: FrameValues values;
>> 557:
>> 558: frame cur_frame = os::current_frame(); // reports caller's frame!
>
> It is unclear what "caller" is relative to in that comment - is it the caller of os::current_frame() as seen by os::current_frame(), or is it the caller of the current method that is invoking os::current_frame() ?
As opposed to "current C frame", it is about "caller's C frame" ;-)
I'll think about a way to make the comment less ambiguous.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3554
More information about the hotspot-runtime-dev
mailing list