Fix interpreter Unix x64 call stub generator#121942
Conversation
The call stub generator is missing support for return buffer passing in RSI, only RDI was supported by mistake. This change fixes it.
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the CoreCLR interpreter's call stub generator for Unix x64 platforms. Previously, the generator only supported return buffer passing in the RDI register (first argument), but lacked support for passing it in RSI (second argument), which is needed when a method has a this pointer. This change properly implements support for both scenarios on Unix x64, matching the existing Windows x64 implementation that uses RCX/RDX.
Key changes:
- Extended
ReturnTypeBuffArg1andReturnTypeBuffArg2enum values to Unix x64 (previously Windows-only) - Added extern declarations and implementations for
CallJittedMethodRetBuffRDI/RSIandInterpreterStubRetBuffRDI/RSI - Updated switch statements to route to the correct assembly functions based on platform
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/coreclr/vm/callstubgenerator.h | Extended ReturnTypeBuffArg1/BuffArg2 to all AMD64 platforms (not just Windows) |
| src/coreclr/vm/callstubgenerator.cpp | Added Unix-specific extern declarations and updated switch statements to handle RDI/RSI return buffer variants |
| src/coreclr/vm/amd64/asmhelpers.S | Implemented InterpreterStubRetBuffRDI/RSI and CallJittedMethodRetBuffRDI/RSI assembly functions for Unix |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Add / fix some comments on #endifs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
The call stub generator is missing support for return buffer passing in RSI, only RDI was supported by mistake.
This change fixes it.
Fixes #121631