Skip to content

Conversation

@davidwrighton
Copy link
Member

  • Instead of setting the target in the CallStubHeader at each invocation, store the target in the CallStubHeader immediately.
  • Avoid invoking the prestub unnecessarily. Instead, detect that we've already run the prestub to completion at least once before poisoning the m_interpreterCode field on MethodDesc.

This may be enough to make some of our tests which are currently timing out pass.

- Instead of setting the target in the CallStubHeader at each invocation, store the target in the CallStubHeader immediately.
- Avoid invoking the prestub unnecessarily. Instead, detect that we've already run the prestub to completion at least once before poisoning the m_interpreterCode field on MethodDesc.

This may be enough to make some of our tests which are currently timing out pass.
@dotnet-policy-service
Copy link
Contributor

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

@davidwrighton
Copy link
Member Author

/azp run runtime-interpreter

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidwrighton
Copy link
Member Author

/azp run runtime-interpreter

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidwrighton davidwrighton marked this pull request as ready for review September 25, 2025 23:12
@davidwrighton davidwrighton requested review from Copilot and removed request for BrzVlad and janvorli September 25, 2025 23:12
@davidwrighton davidwrighton enabled auto-merge (squash) September 25, 2025 23:12
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 optimizes interpreter call performance by reducing redundant work and avoiding unnecessary prestub invocations. The changes focus on storing call targets in CallStubHeader immediately rather than setting them at each invocation, and implementing a poisoning mechanism to prevent repeated failed attempts to get interpreter code.

  • Store call targets in CallStubHeader at creation time to avoid repeated target setting
  • Add poisoning mechanism to prevent redundant prestub calls for methods that cannot be interpreted
  • Optimize call paths by detecting when prestub has already completed successfully

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/coreclr/vm/wasm/helpers.cpp Updates InvokeManagedMethod to handle NULL target by getting multi-callable address
src/coreclr/vm/method.hpp Adds interpreter code poisoning mechanism with new methods and constants
src/coreclr/vm/interpexec.cpp Major optimization changes including target storage in CallStubHeader and poisoning logic
src/coreclr/vm/callstubgenerator.h Adds GetTarget() method to CallStubHeader for retrieving stored targets

@davidwrighton davidwrighton merged commit 1959692 into dotnet:main Sep 26, 2025
113 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants