Skip to content

Use dispatch helper for CoreCLR cached dispatch - #137613

Open
am11 wants to merge 3 commits into
dotnet:mainfrom
am11:feature/coreclr-dispatch-helpers
Open

am11 wants to merge 3 commits into
dotnet:mainfrom
am11:feature/coreclr-dispatch-helpers

Conversation

@am11

@am11 am11 commented Nov 16, 2026

Copy link
Copy Markdown
Member

Bring the #123252 scheme to CoreCLR cached interface dispatch: call sites pass the cell to RhpInterfaceDispatch, the cell caches one MethodTable/target pair, and other pairs go to a global hashtable laid out like GenericCache<Key, nint>.

Cells are updated with a pointer-sized CAS and a release store, so the 16-byte CAS, the per-size stubs and the per-cell caches are gone. NativeAOT's unused 16-byte CAS and the libatomic dependency on riscv64 and loongarch64 are removed as well.

crossgen2 emits the new READYTORUN_HELPER_InterfaceDispatch (R2R 34.1) with 3-pointer cells. Runtimes without cached interface dispatch reject code that uses it.

Bring the dotnet#123252 scheme to CoreCLR cached interface dispatch: call
sites pass the cell to RhpInterfaceDispatch, the cell caches one
MethodTable/target pair, and other pairs go to a global hashtable
laid out like GenericCache<Key, nint>.

Cells are updated with a pointer-sized CAS and a release store, so
the 16-byte CAS, the per-size stubs and the per-cell caches are gone.
NativeAOT's unused 16-byte CAS and the libatomic dependency on
riscv64 and loongarch64 are removed as well.

crossgen2 emits the new READYTORUN_HELPER_InterfaceDispatch (R2R
34.1) with 3-pointer cells. Runtimes without cached interface
dispatch reject code that uses it.

Co-authored-by: Cursor <[email protected]>
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 16, 2026
@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Co-authored-by: Cursor <[email protected]>
…tch-helpers

# Conflicts:
#	src/coreclr/inc/readytorun.h
@am11

am11 commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

@jkotas, follow-up to #123252 (comment): CoreCLR (JIT and R2R) now uses the dispatch helper when cached interface dispatch is enabled.

This doesn't touch the same files as #137436, but once both are in, the NativeAOT and CoreCLR copies of RhpInterfaceDispatch can be merged into one shared helper.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant