JDK-8302745 : sp > unextended_sp for interpreted to interpreted calls going through method handle linker
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 21
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-02-17
  • Updated: 2024-07-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
While discussing https://bugs.openjdk.org/browse/JDK-8302320 it was revealed that frame::sp can be greater than frame::unextended_sp when stack walking, in the case where interpreted -> interpreted calls go through a method handle linker method (such as linkToStatic, linkToVirtual, etc.)

These linkers modify the stack by popping the last argument to a call, which is the MemberName appendix argument which points to the actual callee.

However, the linker code doesn't modify the saved sp which the caller writes into r13 (on x64) before making the call. The callee picks up this value, and it later becomes the sender frame's unextended_sp while stack walking. The regular frame::sp is computed as an offset from the base pointer of the callee frame, so we end with a situation where `sp > unextended_sp`.

This violates an invariant in frame::safe_for_sender (and perhaps other places) that `unextended_sp >= sp`.
Comments
It is not clear how much of an issue this is at the moment, but it seemed good to document, hence the JBS entry.
17-02-2023