Skip to content

Convert PREPARE_SIMPLE_VIRTUAL_CALLSITE usages to use the UCO pattern#124921

Merged
jkoritzinsky merged 8 commits intodotnet:mainfrom
jkoritzinsky:psvcs
Mar 3, 2026
Merged

Convert PREPARE_SIMPLE_VIRTUAL_CALLSITE usages to use the UCO pattern#124921
jkoritzinsky merged 8 commits intodotnet:mainfrom
jkoritzinsky:psvcs

Conversation

@jkoritzinsky
Copy link
Member

Contributes to #123864.

Also remove PREPARE_SIMPLE_VIRTUAL_CALLSITE now that it is unused.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

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 converts the remaining PREPARE_SIMPLE_VIRTUAL_CALLSITE usages in dynamicmethod.cpp to use the more efficient UnmanagedCallersOnly (UCO) pattern, and removes the now-unused PREPARE_SIMPLE_VIRTUAL_CALLSITE macro from callhelpers.h. This is part of the larger effort tracked in issue #123864 to replace MethodDescCallSite/CallDescrWorker infrastructure with UnmanagedCallersOnly reverse P/Invoke calls for better performance when invoking managed code from native code.

Changes:

  • Converted 5 call sites in LCGMethodResolver to use UnmanagedCallersOnlyCaller pattern
  • Added corresponding [UnmanagedCallersOnly] wrapper methods in RuntimeHandles.cs
  • Updated method signatures in metasig.h and corelib.h from instance methods (IM_*) to static methods with pointer parameters (SM_Ptr*)
  • Removed the deprecated PREPARE_SIMPLE_VIRTUAL_CALLSITE and PREPARE_SIMPLE_VIRTUAL_CALLSITE_USING_SLOT macros

Reviewed changes

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

Show a summary per file
File Description
src/coreclr/vm/metasig.h Added 3 new method signature definitions for the converted methods: ResolveToken, ResolveSignature, and GetEHInfo
src/coreclr/vm/corelib.h Updated 4 method definitions from instance methods to static methods with pointer parameters
src/coreclr/vm/callhelpers.h Removed deprecated PREPARE_SIMPLE_VIRTUAL_CALLSITE macros (56 lines) and fixed trailing whitespace
src/coreclr/vm/dynamicmethod.cpp Converted 5 call sites (ResolveToken, ResolveSignature x2, GetRawEHInfo, GetEHInfo) to use UnmanagedCallersOnlyCaller with explicit GC protection
src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs Added 4 new [UnmanagedCallersOnly] wrapper methods with exception out-parameters

Copilot AI review requested due to automatic review settings February 28, 2026 01:13
Copy link
Contributor

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings March 2, 2026 18:30
Copy link
Contributor

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

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

@jkoritzinsky
Copy link
Member Author

/ba-g wbt failures

@jkoritzinsky jkoritzinsky merged commit 9766d74 into dotnet:main Mar 3, 2026
121 of 126 checks passed
@github-project-automation github-project-automation bot moved this to Done in AppModel Mar 3, 2026
@jkoritzinsky jkoritzinsky deleted the psvcs branch March 3, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants