Disable ICorProfiler on non-desktop and WASM platforms#126550
Disable ICorProfiler on non-desktop and WASM platforms#126550AaronRobinsonMSFT merged 6 commits intodotnet:mainfrom
Conversation
Refactor FEATURE_CORPROFILER in clrfeatures.cmake to disable the ICorProfiler feature on Android, Mac Catalyst, iOS, and WASM targets. Previously the profiler was unconditionally enabled and then only explicitly disabled for WASM. This consolidates the logic into a single guard that excludes all unsupported platforms and makes the flag overridable from the command line. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors the CoreCLR CMake feature-flag logic for FEATURE_CORPROFILER so ICorProfiler support is disabled by default on unsupported targets (mobile + WASM) while allowing command-line overrides.
Changes:
- Wrap
FEATURE_CORPROFILERdefaulting inif(NOT DEFINED FEATURE_CORPROFILER)to allow CLI override. - Enable
FEATURE_CORPROFILERonly for non-WASM, non-mobile targets (Android, iOS, Mac Catalyst). - Remove the prior WASM-specific override that forcibly set
FEATURE_CORPROFILER 0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@jkotas @noahfalk I'm updating the logic here based on #126493 (comment). |
|
@dotnet/dotnet-diag Do we have any scenarios for ICorProfiler on iOS and Android? Is anything going to break if we drop it? |
|
@thaystg Please let me know if any of your prototypes need this to a degree that we should defer limiting it for the related platform. |
|
We need this enabled at least until preview 3. |
Other than its use as the in-proc debugger loading mechanism I'm not aware of any other scenarios that require it. @thaystg - are you aware of anything else that requires it?
What if we turned it off for WASM now, and turn it off for Android/iOS in a future preview once we've resolved the in-proc debugging loading? |
I'm not aware of any 3rd parties specifically asking/planning to use it and it hasn't been there historically on Mono. I'd be happy to have it off for now and wait to see some clear evidence that profiler vendors want it on these platforms. |
Done. |
|
/ba-g Unrelated failures |
PR dotnet#126550 disabled FEATURE_CORPROFILER for tvOS but left iOS, MacCatalyst, and Android commented out (profiler still enabled). There is no reason to single out tvOS from its sibling Apple mobile platforms. They should be treated as a package deal. The uncommented 'AND NOT CLR_CMAKE_TARGET_TVOS' line removed profiler fields from the Thread struct on tvOS, making the hardcoded OFFSETOF__Thread__m_pInterpThreadContext in asmconstants.h wrong (0x2b8 vs actual 0x228), breaking all 3 tvOS legs in unified-build. Comment out the tvOS line to match iOS/MacCatalyst/Android, keeping the profiler enabled until all mobile platforms disable it together. Fixes internal unified-build tvOS failures on main (build 2946990). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR dotnet#126550 disabled FEATURE_CORPROFILER for tvOS but left Android, MacCatalyst, and iOS commented out as placeholders. This removed profiler fields from the Thread struct (m_pProfilerFilterContext, m_profilerCallbackState, m_dwProfilerEvacuationCounters — 144 bytes total), shifting m_pInterpThreadContext to a lower offset without updating asmconstants.h. This PR makes two changes: 1. **asmconstants.h**: Add PROFILING_SUPPORTED conditionals to select the correct m_pInterpThreadContext offset when profiling is disabled (0x228 Release, 0xa90 Debug on Unix). 2. **clrfeatures.cmake**: Uncomment the Android, MacCatalyst, and iOS exclusions so all non-desktop platforms consistently disable FEATURE_CORPROFILER. Since asmconstants.h now handles both the profiler and no-profiler cases, these platforms can safely disable profiling without hitting the same offset mismatch. Fixes internal unified-build failures on tvOS legs (tvOS_Shortstack_arm64, tvOSSimulator_Shortstack_x64, tvOSSimulator_Shortstack_arm64) on main. Build: https://dev.azure.com/dnceng/internal/_build/results?buildId=2946990 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR dotnet#126550 disabled FEATURE_CORPROFILER for tvOS but left iOS, MacCatalyst, and Android commented out (profiler still enabled). There is no reason to single out tvOS from its sibling Apple mobile platforms. They should be treated as a package deal. The uncommented 'AND NOT CLR_CMAKE_TARGET_TVOS' line removed profiler fields from the Thread struct on tvOS, making the hardcoded OFFSETOF__Thread__m_pInterpThreadContext in asmconstants.h wrong (0x2b8 vs actual 0x228), breaking all 3 tvOS legs in unified-build. Comment out the tvOS line to match iOS/MacCatalyst/Android, keeping the profiler enabled until all mobile platforms disable it together. Fixes internal unified-build tvOS failures on main (build 2946990). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
) PR #126550 disabled `FEATURE_CORPROFILER` for tvOS (`AND NOT CLR_CMAKE_TARGET_TVOS` uncommented) but left iOS, MacCatalyst, and Android commented out (profiler still enabled). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Note
This PR description was generated with the help of GitHub Copilot.
Refactor
FEATURE_CORPROFILERinclrfeatures.cmaketo consolidate the ICorProfiler feature flag logic:if(NOT DEFINED FEATURE_CORPROFILER), allowing it to be set from the command line.FEATURE_CORPROFILER 0separately.