[clr-interp] Convert call stub logging to LOG2 facility#123273
Merged
davidwrighton merged 6 commits intomainfrom Feb 4, 2026
Merged
[clr-interp] Convert call stub logging to LOG2 facility#123273davidwrighton merged 6 commits intomainfrom
davidwrighton merged 6 commits intomainfrom
Conversation
- Added LF2_INTERPRETER to log facility enum in log.h - Converted all #if LOG_COMPUTE_CALL_STUB blocks to use LOG2 macro with LF2_INTERPRETER and LL_INFO10000 - Removed #define LOG_COMPUTE_CALL_STUB 0 definition - Updated all printf statements to use LOG2 instead Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Convert call stubs logging to use logging facility
[clr-interp] Convert call stub logging to LOG2 facility
Jan 16, 2026
Contributor
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
davidwrighton
approved these changes
Jan 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR converts interpreter call stub logging from compile-time preprocessor directives to runtime-controllable LOG2 facility, making debugging more convenient without requiring recompilation.
Changes:
- Added
LF2_INTERPRETERto the LogFacility2 enum for runtime-controlled interpreter logging - Converted 26 compile-time
#if LOG_COMPUTE_CALL_STUBlogging blocks to runtimeLOG2((LF2_INTERPRETER, LL_INFO10000, ...))calls - Removed the
LOG_COMPUTE_CALL_STUBpreprocessor define and updated associated macros
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/inc/log.h | Added LF2_INTERPRETER = 0x00000002 to LogFacility2 enum for interpreter logging |
| src/coreclr/vm/callstubgenerator.cpp | Removed LOG_COMPUTE_CALL_STUB define and converted all 26 logging statements from compile-time #if blocks to runtime LOG2 calls; updated INVOKE_FUNCTION_PTR and RETURN_TYPE_HANDLER macros |
janvorli
approved these changes
Jan 29, 2026
This was referenced Jan 30, 2026
Open
lewing
pushed a commit
to lewing/runtime
that referenced
this pull request
Feb 9, 2026
## Description
Converts interpreter call stub logging from compile-time `#if
LOG_COMPUTE_CALL_STUB` blocks to runtime-controllable LOG2 facility.
These logging statements have proven valuable for debugging but required
recompilation to enable.
## Changes
- Added `LF2_INTERPRETER = 0x00000002` to LogFacility2 enum
- Converted 26 logging instances to `LOG2((LF2_INTERPRETER,
LL_INFO10000, ...))`
- Removed `#define LOG_COMPUTE_CALL_STUB 0`
- Updated `INVOKE_FUNCTION_PTR` and `RETURN_TYPE_HANDLER` macros
### Before
```cpp
#define LOG_COMPUTE_CALL_STUB 0
PCODE GetGPRegRangeRoutine(int r1, int r2)
{
#if LOG_COMPUTE_CALL_STUB
printf("GetGPRegRangeRoutine %d %d\n", r1, r2);
#endif
// ...
}
```
### After
```cpp
PCODE GetGPRegRangeRoutine(int r1, int r2)
{
LOG2((LF2_INTERPRETER, LL_INFO10000, "GetGPRegRangeRoutine %d %d\n", r1, r2));
// ...
}
```
Logging now enabled via: `DOTNET_LogFacility2=0x2 DOTNET_LogLevel=10000`
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>[clr-interp] Convert logging in call stubs to use logging
facility</issue_title>
> <issue_description>I think we should convert it to the LOG mechanism.
When I wrote these logging statements, I had thought they would likely
be very temporary, but I've used them 4-5 times since then, so they have
some ongoing value. However, I'd like to see that work done in a
separate PR. We should convert them to using LOG statements probably
with a new LF enum value. Probably what should be done is add a new log
facility enum in log.h, call it LF2_INTERPRETER. And convert these log
statements to use the LOG2 macro, with info level LL_INFO10000 instead
of wrapping them in #if LOG_COMPUTE_CALL_STUB blocks.
>
> _Originally posted by @davidwrighton in
dotnet#123142 (comment)
> </issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes dotnet#123272
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/dotnet/runtime/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Co-authored-by: David Wrighton <davidwr@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Converts interpreter call stub logging from compile-time
#if LOG_COMPUTE_CALL_STUBblocks to runtime-controllable LOG2 facility. These logging statements have proven valuable for debugging but required recompilation to enable.Changes
LF2_INTERPRETER = 0x00000002to LogFacility2 enumLOG2((LF2_INTERPRETER, LL_INFO10000, ...))#define LOG_COMPUTE_CALL_STUB 0INVOKE_FUNCTION_PTRandRETURN_TYPE_HANDLERmacrosBefore
After
Logging now enabled via:
DOTNET_LogFacility2=0x2 DOTNET_LogLevel=10000Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.