You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the current plan is to rely on guarded devirtualization for delegates for such things. Pure inlining is complicated because of that cache machinery Roslyn emits - hard to track types.
Ah, I see. Perhaps in some future milestone, linker (or some other pre-processing step) can turn Func and Action into regular methods; at least for simple / non-capturing cases? Couple of attributes in IL are emitted to identify the compiler-generated machinery (more can be added if needed to disambiguate the patterns).
Activity
am11 commentedon Nov 10, 2022
#44610 is planned for 8.0. @EgorBo, does #44610 cover these kind of (simple callback) calls for inlining?
current codegen: https://godbolt.org/z/Wc56zrcoq
EgorBo commentedon Nov 10, 2022
I think the current plan is to rely on guarded devirtualization for delegates for such things. Pure inlining is complicated because of that cache machinery Roslyn emits - hard to track types.
am11 commentedon Nov 10, 2022
Ah, I see. Perhaps in some future milestone, linker (or some other pre-processing step) can turn Func and Action into regular methods; at least for simple / non-capturing cases? Couple of attributes in IL are emitted to identify the compiler-generated machinery (more can be added if needed to disambiguate the patterns).
For reference, C++ lambdas: https://godbolt.org/z/b4GThT8z6 and Swift closures: https://godbolt.org/z/8jf1jxq38 get
CallCalculateoptimized to return 30.