[browser][coreCLR] Support interpreter code resolution on portable entrypoint platforms#127370
Open
pavelsavara wants to merge 4 commits intodotnet:mainfrom
Open
[browser][coreCLR] Support interpreter code resolution on portable entrypoint platforms#127370pavelsavara wants to merge 4 commits intodotnet:mainfrom
pavelsavara wants to merge 4 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes EventPipe/ETW instruction-pointer (IP) to managed-method resolution for interpreted methods on WASM, where CoreCLR uses FEATURE_PORTABLE_ENTRYPOINTS instead of interpreter precodes. This enables the sampling profiler to correctly attribute samples to interpreted managed methods.
Changes:
- Update
MethodDesc::JitCompileCodeLockedEventWrapperto derive the interpreted-method “native start address” fromPortableEntryPointinterpreter data whenFEATURE_PORTABLE_ENTRYPOINTSis enabled. - Update
MethodAndStartAddressToEECodeInfoPointerto fall back toMethodDesc::GetInterpreterCode()(returning theInterpByteCodeStartpointer) when no explicit start address is supplied on portable-entrypoint interpreter builds.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/vm/prestub.cpp | Uses PortableEntryPoint::GetInterpreterData to compute the method start address for interpreted-method ETW events under portable entrypoints. |
| src/coreclr/vm/eventtrace.cpp | Adds a portable-entrypoints interpreter fallback so method events can resolve InterpByteCodeStart when no explicit start address is provided. |
jkotas
reviewed
Apr 24, 2026
This was referenced Apr 24, 2026
Open
58f8b7d to
e077850
Compare
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.
Summary
Generalizes
GetInterpreterCodeFromInterpreterPrecodeIfPresent(renamed toGetInterpreterCodeFromEntryPointIfPresent) to resolve interpreter bytecode addresses on platforms that useFEATURE_PORTABLE_ENTRYPOINTS(e.g., browser WASM) whereInterpreterPrecodedoes not exist.Motivation
The sampling profiler does not work on WASM because the EventPipe code paths that resolve instruction pointers (IPs) to method information assume the traditional
InterpreterPrecodemechanism. On WASM, CoreCLR uses portable entrypoints (FEATURE_PORTABLE_ENTRYPOINTS) instead of interpreter precodes, so the existing code silently returns wrong or zero addresses, causing the profiler to fail to attribute samples to managed methods.Split from #126324 for smaller reviews
Changes
Renamed function with new signature
GetInterpreterCodeFromInterpreterPrecodeIfPresent(TADDR)→GetInterpreterCodeFromEntryPointIfPresent(TADDR, MethodDesc*)pMethodDescparameter (defaulting toNULL) enables resolution on portable entrypoint platforms viaMethodDesc::GetInterpreterCode().New portable entrypoint code path (
precode.cpp)Added
#elif defined(FEATURE_INTERPRETER) && defined(FEATURE_PORTABLE_ENTRYPOINTS)branch:pMethodDescis provided, callspMethodDesc->GetInterpreterCode()to get theInterpByteCodeStartpointer directly from the MethodDesc, bypassing the precode entirely.pMethodDescis NULL or no interpreter code exists.Portable entrypoint handling in
prestub.cppAdded
#ifdef FEATURE_PORTABLE_ENTRYPOINTSbranch inJitCompileCodeLockedEventWrapperto usePortableEntryPoint::GetInterpreterData(pCode)instead ofInterpreterPrecode::FromEntryPoint(pCode)when extracting theInterpByteCodeStartfor ETW method-jitted events.Caller updates (DAC/debugger/ETW)
All callers updated to pass the new
MethodDesc*parameter where available:daccess.cpp—GetMethodVarInfo,GetMethodNativeMap,RawGetMethodNamedacdbiimpl.cpp—GetNativeCodeInfoForAddrrequest.cpp—CopyNativeCodeVersionToReJitData,GetMethodDescData,GetTieredVersionsfunctioninfo.cpp—CreateDJIsForMethodDesceventtrace.cpp—MethodAndStartAddressToEECodeInfoPointer(passesNULLwhen a specific code address was provided,pMethodDescotherwise)method.hpp—GetCodeForInterpreterOrJitted