-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[clr-interp] Enable rejit in the interpreter #122626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[clr-interp] Enable rejit in the interpreter #122626
Conversation
- Rely on resetting the interpreter code pointer to trigger the existing rejit/prestub logic to fill in any gaps we have.
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
There was a problem hiding this 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 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 inResetCodeEntryPoint()andResetCodeEntryPointForEnC()to clear interpreter state during entry point resets - Adds
ClearInterpreterCodePointer()inPublishNativeCodeVersion()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.
| File | Description |
|---|---|
| src/coreclr/vm/method.cpp | Adds interpreter code pointer clearing in two entry point reset methods to support rejit scenarios |
| src/coreclr/vm/codeversion.cpp | Clears interpreter code pointer when publishing new native code versions to ensure proper rejit behavior |
| #ifdef FEATURE_INTERPRETER | ||
| // When we hit the Precode that should fixup any issues with an unset interpreter code pointer. This is notably most important in ReJIT scenarios | ||
| pMethod->ClearInterpreterCodePointer(); | ||
| #endif |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected at the end of this line. According to the repository's code formatting conventions, there should be no trailing whitespace.
| #endif | |
| #endif |
| #ifdef FEATURE_INTERPRETER | ||
| // When we hit the Precode that should fixup any issues with an unset interpreter code pointer. This is notably most important in ReJIT scenarios | ||
| pMethod->ClearInterpreterCodePointer(); | ||
| #endif | ||
| #ifdef FEATURE_TIERED_COMPILATION |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation of the preprocessor directives is inconsistent with the surrounding code. The '#ifdef' and '#endif' directives should be aligned at column 0 (no indentation), following the standard C/C++ convention and the pattern used elsewhere in this file.
| #ifdef FEATURE_INTERPRETER | |
| // When we hit the Precode that should fixup any issues with an unset interpreter code pointer. This is notably most important in ReJIT scenarios | |
| pMethod->ClearInterpreterCodePointer(); | |
| #endif | |
| #ifdef FEATURE_TIERED_COMPILATION | |
| #ifdef FEATURE_INTERPRETER | |
| // When we hit the Precode that should fixup any issues with an unset interpreter code pointer. This is notably most important in ReJIT scenarios | |
| pMethod->ClearInterpreterCodePointer(); | |
| #endif | |
| #ifdef FEATURE_TIERED_COMPILATION |
|
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 ? |
This fixes the rejit test