-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
could JIT can inline closure Action? #34634
Comments
Theoretically, if JIT inlines call to Foreach at a particular callsite, it could find that the delegate points to a closure, get rid of the closure allocation, inline the call and "inline" the closure's fields as local variables. |
Methods with loops never inline, they simply don't pass this check: runtime/src/coreclr/src/jit/inlinepolicy.cpp Lines 492 to 495 in a605729
(well, if [AgressiveInlining] is not set of course) |
Related to #6498
Author asked about inlining of delegate invocation inside of this method. |
Are you sure? Simple loops can have 5 or fewer BBs.
Following up on what @sakno said, there are some notes on what it would take to inline a delegate invoke starting at this comment, and a number of issues to sort through before we're anywhere close to being able to do this. |
in the
test
function, callForeach
function will new a small object closure.can CoreCLR JIT Engine inline this simple closure call?
The text was updated successfully, but these errors were encountered: