-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Implement interpreter PInvoke Calli #119356
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
Implement interpreter PInvoke Calli #119356
Conversation
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 implements missing PInvoke support for the interpreter's Calli (indirect call) functionality in the CoreCLR runtime. The implementation ensures proper GC mode handling when calling native functions through function pointers.
Key changes:
- Added a new
InvokePInvokeCalliStub
function that handles PInvoke calls with proper GC mode transitions - Extended the Calli opcode to include PInvoke detection information
- Refactored Calli emission code to centralize the logic and include calling convention analysis
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/coreclr/vm/wasm/helpers.cpp | Added stub implementation of InvokePInvokeCalliStub for WASM platform |
src/coreclr/vm/interpexec.cpp | Implemented InvokePInvokeCalliStub with proper GC transitions and updated Calli execution logic |
src/coreclr/interpreter/intops.def | Extended Calli opcodes to include an additional parameter for PInvoke detection |
src/coreclr/interpreter/compiler.h | Added declaration for new EmitCalli helper method |
src/coreclr/interpreter/compiler.cpp | Implemented EmitCalli method and refactored call emission to use it |
The Calli implementation was missing support for the case when the targer is a pinvoke. That resulted in errors due to incorrect GC mode. This change fixes that.
1b6d8da
to
137d62b
Compare
* Disable calli with marshalled pinvokes * Refactor the target invocation methods
The Calli implementation was missing support for the case when the targer is a pinvoke. That resulted in errors due to incorrect GC mode. This change fixes that.