-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix args passed by stack ref in the CallStubGenerator #117399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The CallStubGenerator was missing support for arguments passed by reference using stack slots. Only references in registers were implemented. There was also a bug in passing return buffer argument when there was "this" at the same time. Only the m_r1 was set to 1, but the m_r2 was left unchanged, being 0. That resulted in the routine fetched for that register range being NULL. This change fixes both of these issues and adds a test.
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for arguments passed by reference on the stack, fixes return-buffer register setup when a this parameter is present on Windows AMD64, and adds a new interpreter/JIT calling convention test.
- Introduce
GetStackRefRoutineand corresponding assembly helpers for stack-based by-ref args. - Initialize
m_r2to properly handle return-buffer +thison Windows AMD64. - Add
TestCallingConvention13suite to validate the new stack-ref code paths.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/JIT/interpreter/Interpreter.cs | Add TestCallingConvention13* methods and integrate into test runners |
| src/coreclr/vm/callstubgenerator.h | Declare new GetStackRefRoutine method |
| src/coreclr/vm/callstubgenerator.cpp | Define GetStackRefRoutine, handle by-ref stack args, fix m_r2 init |
| src/coreclr/vm/arm64/asmhelpers.asm | Add Load_Stack_Ref/Store_Stack_Ref and ref-copy macro |
| src/coreclr/vm/arm64/asmhelpers.S | Mirror new stack-ref routines and macro in assembler |
| src/coreclr/vm/amd64/AsmHelpers.asm | Add Load_Stack_Ref/Store_Stack_Ref routines for AMD64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/ba-g build failure is unrelated, I've created #117413 to track it. |
The CallStubGenerator was missing support for arguments passed by reference using stack slots. Only references in registers were implemented. There was also a bug in passing return buffer argument when there was "this" at the same time. Only the m_r1 was set to 1, but the m_r2 was left unchanged, being 0. That resulted in the routine fetched for that register range being NULL.
This change fixes both of these issues and adds a test.