-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix interpreter jmp to pinvoke #121329
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
Fix interpreter jmp to pinvoke #121329
Conversation
The interpreter compiler ignores tail call prefix for tail calls (and jmp) to pinvokes that are not marshalled. But it is not injecting "ret" IR opcode after the call returns, which results in BADCODE reported by the compiler. There are several coreclr tests in the JIT/jit64/mcc/interop that fail due to that. This change adds injecting proper form of "ret" IR opcode after such calls.
|
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 fixes an issue where tail calls to PInvoke methods (which are not marshaled) are incorrectly handled in the interpreter compiler. Since PInvokes are not IL code, they cannot be tail-called directly. The PR converts such tail calls to normal calls followed by an injected return instruction to preserve the intended semantics.
- Adds logic to detect when a tail call target is a non-marshaled PInvoke and converts it to a normal call
- Injects appropriate return instructions after the call based on the return type
|
/ba-g the android timeout is unrelated. |
The interpreter compiler ignores tail call prefix for tail calls (and jmp) to pinvokes that are not marshalled. But it is not injecting "ret" IR opcode after the call returns, which results in BADCODE reported by the compiler.
There are several coreclr tests in the JIT/jit64/mcc/interop that fail due to that.
This change adds injecting proper form of "ret" IR opcode after such calls.