[ObjCRuntime] Use Type.GetMemberWithSameMetadataDefinitionAs to find closed generic members. Fixes #18355 - #26143
Conversation
…closed generic members Replace the loop in Runtime.FindClosedMethod that iterated over all methods on the closed type comparing metadata tokens with a single call to Type.GetMemberWithSameMetadataDefinitionAs, which does exactly this lookup natively and avoids materializing the full method list. Fixes #18355 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves performance in the dynamic registrar by optimizing how closed generic methods are located at runtime. It replaces a full method enumeration (and metadata token comparisons) with a direct lookup using Type.GetMemberWithSameMetadataDefinitionAs, avoiding materializing all methods on the closed type.
Changes:
- Replace
closed_type.GetMethods(...DeclaredOnly)iteration +MetadataTokencomparisons withclosed_type.GetMemberWithSameMetadataDefinitionAs(open_method). - Update the associated ILLink (IL2070) suppression comment to reflect the new API call.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…use-type-getmemberwithsamemetadatadefini-5d5fa8
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…use-type-getmemberwithsamemetadatadefini-5d5fa8
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…amemetadatadefini-5d5fa8
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #c7be758] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 203 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Replace the loop in
Runtime.FindClosedMethodthat iterated over all methods on the closed type comparing metadata tokens with a single call toType.GetMemberWithSameMetadataDefinitionAs, which performs exactly this lookup natively and avoids materializing the full method list.This speeds up finding closed generic members in the dynamic registrar.
Fixes #18355
🤖 Pull request created by Copilot