Skip to content

Collapse the recent ILStub generation patterns into a helper #115673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

AaronRobinsonMSFT
Copy link
Member

No description provided.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates the ILStub generation logic into a single helper function to reduce code duplication and improve maintainability.

  • Removed duplicate ILStub generation blocks across multiple files.
  • Introduced the new helper function FinalizeILStub in ilstubresolver.{h,cpp} that now centralizes IL generation steps, including EH clause processing.
  • Updated call sites in unsafeaccessors.cpp, instancecalli.cpp, dllimport.cpp, asyncthunks.cpp, and ilstubcache.cpp to use FinalizeILStub.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/vm/unsafeaccessors.cpp Replaced inline ILStub generation with FinalizeILStub call.
src/coreclr/vm/instancecalli.cpp Replaced inline ILStub generation with FinalizeILStub call.
src/coreclr/vm/ilstubresolver.h Declared FinalizeILStub helper function.
src/coreclr/vm/ilstubresolver.cpp Defined FinalizeILStub with additional EH clause processing.
src/coreclr/vm/ilstubcache.cpp Replaced inline ILStub generation with FinalizeILStub call.
src/coreclr/vm/dllimport.cpp Replaced inline ILStub generation with FinalizeILStub call.
src/coreclr/vm/asyncthunks.cpp Replaced inline ILStub generation with FinalizeILStub call.
Comments suppressed due to low confidence (4)

src/coreclr/vm/unsafeaccessors.cpp:1010

  • This call now integrates EH clause processing (via FinalizeILStub) which was not present in the original inline block. Please confirm that adding EH clause handling here is the intended behavior.
FinalizeILStub(ilResolver, &sl, resolver, methodILDecoder);

src/coreclr/vm/instancecalli.cpp:65

  • The newly centralized FinalizeILStub now processes EH clauses which the original block did not. Verify that this change in behavior is acceptable for the instance call site.
FinalizeILStub(ilResolver, &sl, resolver, methodILDecoder);

src/coreclr/vm/dllimport.cpp:6486

  • The consolidation into FinalizeILStub adds EH clause processing; confirm that this additional logic does not affect existing assumptions at this call site.
FinalizeILStub(ilResolver, &sl, ppResolver, ppHeader);

src/coreclr/vm/asyncthunks.cpp:56

  • The refactored code now includes EH clause handling that was previously omitted here. Please ensure that integrating this logic is intended and does not impact async thunk generation.
FinalizeILStub(ilResolver, &sl, resolver, methodILDecoder);

Copy link
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AaronRobinsonMSFT
Copy link
Member Author

/ba-g Unrelated failures

@AaronRobinsonMSFT AaronRobinsonMSFT merged commit 2e77d32 into dotnet:main May 19, 2025
91 of 95 checks passed
@AaronRobinsonMSFT AaronRobinsonMSFT deleted the reduce_stubgen_duplication branch May 19, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants