Skip to content

Conversation

@davidwrighton
Copy link
Member

@davidwrighton davidwrighton commented Sep 29, 2025

  • Disable shuffle thunk creation for portable entrypoints and enable ILDelegateShuffle thunks instead
  • Also implement the shuffle thunk in the interpreter directly so that most cases don't need to even use those in WASM or cases where we have pregenerated code
  • Add a new opcode for tail-calling a delegate method

…egates in wasm

- Disable shuffle thunk creation for portable entrypoints and enable ILDelegateShuffle thunks instead
- Also implement the shuffle thunk in the interpreter directly so that most cases don't need to even use those in WASM or cases where we have pregenerated code
- Add a new opcode for tail-calling a delegate method
@Copilot Copilot AI review requested due to automatic review settings September 29, 2025 18:20
@davidwrighton davidwrighton changed the title [clr-interp] Implement tail-calling for delegates and support for del… [clr-interp] Implement tail-calling for delegates and support for delegates in wasm Sep 29, 2025
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 29, 2025
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 implements tail-calling for delegates in the CLR interpreter and enables delegate support in WebAssembly by modifying how delegate shuffle thunks are handled.

  • Adds a new INTOP_CALLDELEGATE_TAIL opcode for tail-calling delegate methods
  • Disables shuffle thunk creation for portable entrypoints and enables IL delegate shuffle thunks instead
  • Implements shuffle thunk logic directly in the interpreter to avoid needing shuffle thunks for most WASM cases

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/vm/interpexec.cpp Implements tail-call delegate handling and direct shuffle thunk execution in interpreter
src/coreclr/vm/comdelegate.cpp Disables portable shuffle array generation and enables IL delegate shuffle thunks for portable entrypoints
src/coreclr/interpreter/inc/intops.def Adds new INTOP_CALLDELEGATE_TAIL opcode definition
src/coreclr/interpreter/compiler.cpp Emits INTOP_CALLDELEGATE_TAIL opcode for tail-call delegate invocations

Copy link
Member

@kg kg left a comment

Choose a reason for hiding this comment

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

Looks right other than Copilot's comment pointing out the potential null dereference for static delegates

@davidwrighton davidwrighton marked this pull request as draft September 29, 2025 21:28
@davidwrighton davidwrighton marked this pull request as ready for review September 29, 2025 21:55
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 4 out of 4 changed files in this pull request and generated 2 comments.

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@davidwrighton davidwrighton enabled auto-merge (squash) September 29, 2025 22:50
@davidwrighton davidwrighton merged commit 691e950 into dotnet:main Sep 30, 2025
98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants