Repository navigation
[NOMERGE] JIT: Widen shared generic struct constrained call inlining - #138037
Draft
NinoFloris wants to merge 9 commits into
Draft
NinoFloris wants to merge 9 commits into
NinoFloris wants to merge 9 commits into
Conversation
Add prepareCallLookups to supply the hidden instantiation argument as a full CORINFO_LOOKUP. The JIT and interpreter request runtime-dependent lookups only when needed, preserving on-demand preparation while moving token and context selection into the EE. Update NativeAOT, ReadyToRun and SuperPMI for the shared interface.
Move runtime lookup construction for CORINFO_CALL_CODE_POINTER from getCallInfo to prepareCallLookups. Calls that disappear before preparation no longer reserve dictionary entries. Mark pending lookups as CORINFO_LOOKUP_DEFERRED, preserving NOT_SUPPORTED for inline rejection, and record completed lookups in SuperPMI.
Route hidden arguments and code pointers through call-specific materialization helpers in the JIT and interpreter. Each helper completes a deferred lookup before consuming it, so call sites no longer need a separate preparation step.
…tion Record shared generic interface dispatch lookups in getCallInfo and complete them through prepareCallLookups only when the importer still needs the stub. Keep the call symbolic through early devirtualization so calls resolved there do not reserve unused dictionary slots. Apply the same deferral in ReadyToRun and teach SuperPMI preparation recording and replay to handle stub lookups. Cover surviving interface dispatch and exact-receiver devirtualization in shared generic code.
Carry the selected implementation in the deferred lookup and instantiate it when preparing the dictionary entry instead of repeating interface resolution. Handle inherited and static default implementations, retain ambiguous-target and ReadyToRun versioning fallbacks, and record the deferred payload explicitly in SuperPMI.
Resolve a constrained interface call on a shared value type to the concrete implementation on that type and emit a direct call instead of an indirect runtime-lookup code pointer. The direct call is an inline candidate, so the implementation can be inlined and the type context can fold away when unused. The hidden instantiation argument is obtained from the constrained type token, which names the exact value type, rather than the interface method token. Ambiguous or forced targets, default implementations on another owner, generic-method targets, and reference-type receivers keep the runtime-lookup path. Add ConstrainedTypeContext covering used and unused contexts, class and method caller contexts, constructed contexts, mutation, initialization, default implementations, reference types, generic-method fallbacks, and static delegate creation.
Obtain the constrained type context through the deferred instParamLookup and prepareCallLookups instead of reading the constrained token eagerly in the JIT. The EE selects the token and context, keeping on-demand preparation and matching the deferred lookup path used for the rest of the call. Behavior is unchanged. Retire the note describing the missing dictionary infrastructure now that prepareCallLookups embeds the constrained handle.
…tructs Make a constrained static virtual call that resolves to a default interface method a direct, inlinable call instead of a runtime-lookup code pointer. The declaring interface's context is supplied as a deferred lookup, computed from the resolved method through a DeclaringTypeHandleFromMethodSlot dictionary entry. getCallInfo keeps the call direct when the default implementation resolves through a single interface slot and falls back to the code-pointer path otherwise. Wire the slot through the JIT dictionary encoder and resolver.
Make a constrained call that resolves to a generic method on the constrained value type a direct, inlinable call instead of a runtime-lookup code pointer. The method's own context is supplied as a deferred lookup, computed from the resolved method through a MethodDescSlot dictionary entry. getCallInfo keeps the call direct for a resolved generic-method target and falls back to the code-pointer path when the constraint cannot be resolved.
|
Azure Pipelines: Successfully started running 6 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging @dotnet/jit-contrib for JIT-EE GUID update |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
Author
|
@MihuBot -nuget |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #137990 and #138013