Skip to content

[clr-interp] Fix a grab bag of issues, mostly around the profiler#122421

Merged
davidwrighton merged 4 commits intodotnet:mainfrom
davidwrighton:interpreter_grab_bag
Dec 11, 2025
Merged

[clr-interp] Fix a grab bag of issues, mostly around the profiler#122421
davidwrighton merged 4 commits intodotnet:mainfrom
davidwrighton:interpreter_grab_bag

Conversation

@davidwrighton
Copy link
Member

  • Add support for tracking transitions via the profiler/debugger internal apis
    • Notably this involves calls to ProfilerManagedToUnmanagedTransitionMD/ProfilerUnmanagedToManagedTransitionMD for the profiler
    • And DebuggerTraceCall for the debugger on reverse p/invoke
  • Disabling the enter/leave hooks in the ICorProfiler api
    • We now detect attempts to generate these in the interpreter compiler, and will fail the compile
    • Adding a PlatformDetection flag for disabling the tests which depend on this
    • And adjust several tests to use this flag
  • Adjusting profiler test testing the ability of the profiler to control inlining by disabling that portion of that profiler test as the interpreter can't do that
  • Finally disabling the R2RDumpTests test when the interpreter is enabled. It works, but its really slow, so lets not wait for it to finish in any of our test passes

This should fix JIT/profiler/elt/slowpatheltenter, JIT/profiler/elt/slowpatheltleave, JIT/profiler/unittest/inlining, JIT/profiler/transitions/transitions, profiler/dynamicoptimization/DynamicOptimization and readytorun/r2rdump/FrameworkTests/R2RDumpTests.

- Add support for tracking transitions via the profiler/debugger internal apis
  - Notably this involves calls to ProfilerManagedToUnmanagedTransitionMD/ProfilerUnmanagedToManagedTransitionMD for the profiler
  - And DebuggerTraceCall for the debugger on reverse p/invoke
- Disabling the enter/leave hooks in the ICorProfiler api
  - We now detect attempts to generate these in the interpreter compiler, and will fail the compile
  - Adding a PlatformDetection flag for disabling the tests which depend on this
  - And adjust several tests to use this flag
- Adjusting profiler test testing the ability of the profiler to control inlining by disabling that portion of that profiler test as the interpreter can't do that
- Finally disabling the R2RDumpTests test when the interpreter is enabled. It works, but its really slow, so lets not wait for it to finish in any of our test passes
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

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 adds profiler and debugger support for the CoreCLR interpreter, specifically for tracking transitions between managed and unmanaged code. Key fixes include:

  • Adding profiler transition tracking for reverse P/Invoke and unmanaged calli operations
  • Disabling ICorProfiler enter/leave hooks support in the interpreter (not supported)
  • Adjusting tests to skip when enter/leave hooks are unavailable

Reviewed changes

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

Show a summary per file
File Description
src/coreclr/vm/prestub.cpp Adds profiler/debugger transition tracking for reverse P/Invoke in ExecuteInterpretedMethod
src/coreclr/vm/jithelpers.cpp Changes DebuggerTraceCall from static to non-static for use in prestub.cpp
src/coreclr/vm/interpexec.cpp Adds profiler transition tracking for unmanaged calli operations
src/coreclr/vm/dllimportcallback.h Declares new non-destructive getter for UMEntryThunkData
src/coreclr/vm/dllimportcallback.cpp Implements GetMostRecentUMEntryThunkDataNonDestructive()
src/coreclr/interpreter/inc/interpretershared.h Adds publishSecretStubParam field to InterpMethod structure
src/coreclr/interpreter/compiler.h Adds m_corJitFlags member to cache JIT flags
src/coreclr/interpreter/compiler.cpp Refactors to use cached m_corJitFlags, adds detection for unsupported PROF_ENTERLEAVE flag, and handles PROF_NO_PINVOKE_INLINE
src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs Adds IsICorProfilerEnabled and IsICorProfilerEnterLeaveHooksEnabled properties
src/tests/profiler/unittest/inlining.cs Adds check to skip test when enter/leave hooks are disabled
src/tests/profiler/elt/slowpatheltleave.cs Adds check to skip test when enter/leave hooks are disabled
src/tests/profiler/elt/slowpatheltenter.cs Adds check to skip test when enter/leave hooks are disabled
src/tests/profiler/dynamicoptimization/DynamicOptimization.cs Adjusts test expectations for interpreter (no inlining support)
src/tests/readytorun/r2rdump/FrameworkTests/R2RDumpTests.csproj Marks test as InterpreterIncompatible due to excessive runtime

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) December 11, 2025 02:14
@davidwrighton davidwrighton merged commit 08ee4f1 into dotnet:main Dec 11, 2025
105 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2026
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.

3 participants