Open blowin opened 4 years ago
current codegen: https://godbolt.org/z/Wc56zrcoq
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
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).
For reference, C++ lambdas: https://godbolt.org/z/b4GThT8z6 and Swift closures: https://godbolt.org/z/8jf1jxq38 get CallCalculate
optimized to return 30.
Now:
Compile to:
Is inline lambda possible? Like this:
category:cq theme:inlining skill-level:expert cost:large