-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: enable inlining of IL stubs with EH #118140
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
Also, bail out of inlining analysis early if the pinvoke call was marked as unmanaged during initial pinvoke analysis. Closes dotnet#113742
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 enables the JIT to inline P/Invoke IL stubs that contain exception handling (EH) by removing a previous restriction. The change also adds early bailout logic to avoid unnecessary inlining analysis for calls already marked as unmanaged during P/Invoke analysis.
Key changes:
- Adds new inline observation type for unmanaged code detection
- Introduces early bailout for unmanaged calls in inlining analysis
- Removes restriction preventing inlining of P/Invoke stubs with exception handling
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/coreclr/jit/inline.def | Adds IS_UNMANAGED observation type for fatal inline rejection |
src/coreclr/jit/importercalls.cpp | Adds early unmanaged call detection and removes P/Invoke EH inlining restriction |
|
||
if (methAttr & CORINFO_FLG_PINVOKE) | ||
{ | ||
// We should have already ruled out cases where we can directly call the unamanged method. |
Copilot
AI
Jul 28, 2025
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.
There is a spelling error in the comment: 'unamanged' should be 'unmanaged'.
// We should have already ruled out cases where we can directly call the unamanged method. | |
// We should have already ruled out cases where we can directly call the unmanaged method. |
Copilot uses AI. Check for mistakes.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Still assessing this one, not sure we want to enable the extra inlining. |
NAOT size impact is a small net decrease, per MichalStrehovsky/rt-sz#153 |
@jkotas any opinion on whether this is worth doing on its own? Based on the above I would say no, there's not much benefit. Seems like we should sort out the schizophrenia around stub inlining in the JIT first, but I'm somewhat reluctant to churn those code paths at this point in the release. |
Yes, I agree. It is fine to postpone it to .NET 11. This is not fixing any regressions. |
Opened #118220 to track sorting out the inlining logic. |
Also, bail out of inlining analysis early if the pinvoke call was marked as unmanaged during initial pinvoke analysis.
Closes #113742