Skip to content

[clr-interp] Enable rejit in the interpreter - #122626

Merged
davidwrighton merged 3 commits into
dotnet:mainfrom
davidwrighton:enable_rejit_for_interpreter
Dec 19, 2025
Merged

[clr-interp] Enable rejit in the interpreter#122626
davidwrighton merged 3 commits into
dotnet:mainfrom
davidwrighton:enable_rejit_for_interpreter

Conversation

@davidwrighton

@davidwrightondavidwrighton commented Dec 17, 2025

Copy link
Copy Markdown
Member
  • Rely on resetting the interpreter code pointer to trigger the existing rejit/prestub logic to fill in any gaps we have.

This fixes the rejit test

- Rely on resetting the interpreter code pointer to trigger the existing rejit/prestub logic to fill in any gaps we have.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request enables ReJIT support in the interpreter by adding calls to clear the interpreter code pointer at strategic points in the code versioning and entry point management flow. The changes ensure that when code versions are updated or reset, the interpreter state is properly cleared, allowing the existing rejit/prestub logic to rebuild the interpreter state as needed.

  • Adds ClearInterpreterCodePointer() calls in ResetCodeEntryPoint() and ResetCodeEntryPointForEnC() to clear interpreter state during entry point resets
  • Adds ClearInterpreterCodePointer() in PublishNativeCodeVersion() when setting new native code versions to ensure interpreter state is synchronized with code versioning

Reviewed changes

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

FileDescription
src/coreclr/vm/method.cppAdds interpreter code pointer clearing in two entry point reset methods to support rejit scenarios
src/coreclr/vm/codeversion.cppClears interpreter code pointer when publishing new native code versions to ensure proper rejit behavior

Comment threadsrc/coreclr/vm/codeversion.cpp Outdated
Comment threadsrc/coreclr/vm/codeversion.cpp Outdated
@BrzVlad

Copy link
Copy Markdown
Member

Is this resetting of the code pointer for a method the same mechanism that is used also for EnC functionality when debugging. I suspect precodes might also need flushing, but this might already be integrated with the rest of the runtime ?

@davidwrighton

Copy link
Copy Markdown
MemberAuthor

@BrzVlad This may be enough to make System.Reflection.Metadata.MetadataUpdater.ApplyUpdate work correctly, but certainly not enough for full EnC functionality.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@davidwrighton
davidwrighton enabled auto-merge (squash) December 18, 2025 21:14
@davidwrighton
davidwrighton merged commit a83d76a into dotnet:mainDec 19, 2025
98 checks passed
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Jan 18, 2026
Sign up for freeto 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.

3 participants

@davidwrighton@BrzVlad