Repository navigation
Fix GetILToNativeMapping2 ignoring its reJitId - #136678
Merged
lateralusX merged 1 commit intoNov 6, 2026
Merged
Conversation
GetILToNativeMapping2 looked up the IL code version for reJitId but did not store the result, so it always used the method's default native code version. Store the IL code version returned by the lookup. If no version has that reJitId, skip the native code search, so that the call returns E_INVALIDARG. Take the first native code version that has code, as GetNativeCodeStartAddresses does, so that a tier-up compile still in progress does not hide already compiled code. Extend the rejit profiler test to check the map returned for each ReJIT ID, for the default version, and for an unknown ReJIT ID. Fixes dotnet#136669
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
lateralusX
approved these changes
Oct 30, 2026
Contributor
Author
|
Thank you for the review and merge! |
This was referenced Nov 6, 2026
BrzVlad
added a commit
that referenced
this pull request
Nov 13, 2026
Interpreter code can be present in the set of native code versions for a method, which holds the address of the interpreter precode there, instead of the actual interpreter bytecode address. Some profiler APIs (`GetILToNativeMapping2` and `GetNativeCodeStartAddresses`) were not handling this case, crashing later when trying to obtain information from the runtime for an invalid code address. Should fix interpreter failures on rejit test. Additional profiler testing was added in #136678, which hit this bug on the interpreter runs.
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.
Fixes #136669
ProfToEEInterfaceImpl::GetILToNativeMapping2looked up the IL code version forreJitIdbut did not store the result, so it always used the method's default native code version. It now stores the version, and looks for native code only when a version was found. AreJitIdthat matches no IL version of the method now returnsE_INVALIDARGinstead of the default version's map. The error comes from the existing null-address check inGetILToNativeMapping3.GetILToNativeMapping2also takes the first native code version that has code, asGetNativeCodeStartAddressesdoes, so that a tier-up compile still in progress does not hide already compiled code. When the default native code version has code,reJitId0 still returns its map.The
rejitprofiler test now checks, after the ReJIT'd target method has run and before the revert:GetNativeCodeStartAddressesand their maps fromGetILToNativeMapping3. The map fromGetILToNativeMapping2must match at least one of those maps;E_INVALIDARG.The test runs with tiered compilation disabled, so it does not cover a tier-up compile in progress.
Testing used
mainat e522423 as the base. Each runtime variant below ran therejittest 20 times with a linux-x64 Checked runtime andDOTNET_TieredCompilation=0(the test is optimization-sensitive):S_OKmainS_OKNote
This change was prepared with AI assistance (Anthropic Claude and OpenAI Codex) under my direction. AI agents ran the builds and tests on my machine. I reviewed the change and the test results before opening it.