We have no heuristic for inlining at the moment; all methods with less than 8 blocks are inlined, that's obviously not great for real world scenarios.
We also need to be careful in some cases:
Inlining methods accessing private members. If they're on the same assembly, we can simply change it to public or internal; otherwise, we could disable access checks using System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute.
Inlining methods from other assemblies (especially runtime assemblies). Probably not a problem for self contained/AOT-ish assemblies
Other ideas
Since we can inline lambdas that have a known callsite within the same method, we may benefit by some special cases:
Increase budget for methods defined in Enumerable (for Linq), or a Enumerator-like (T get_Current, bool MoveNext()) class
Increase budget for methods called with a lambda argument whose callsite is known
We have no heuristic for inlining at the moment; all methods with less than 8 blocks are inlined, that's obviously not great for real world scenarios.
We also need to be careful in some cases:
System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute
.Other ideas
Since we can inline lambdas that have a known callsite within the same method, we may benefit by some special cases:
Enumerable
(for Linq), or a Enumerator-like (T get_Current
,bool MoveNext()
) class