-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
Today, the JIT uses a set of heuristics to determine whether or not a method is profitable to inline. However, due to tokens being unique per module and due to the cost associated with resolving tokens the JIT (when inlining) can't easily see when certain code patterns will result in constants or otherwise dead code elimination. This can hinder the ability for the JIT to correctly inline methods with things like Isa.IsSupported
, if (typeof(T) == typeof(...))
checks, or even string.Length
.
As such, I propose we create a cache (effectively a Dictionary<TokenId, MethodInfo>
or similar, per module) of well known methods (i.e. certain NamedIntrinsic
s) so the inliner can correctly determine if the inlining is profitable.
This table could be built up during Tier 0 and would be available during Tier 1 so that the inliner can correctly see when a call is constant and do the appropriate dead code elimination and size adjustments.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status