Skip to content

Conversation

kotlarmilos
Copy link
Member

@kotlarmilos kotlarmilos commented Oct 16, 2025

Description

This PR updates code-versioning and debugger/DAC paths with FEATURE_CODE_VERSIONING and provides stubs where needed. Code versioning was moved under tiered compilation in #120583, which is disabled for Apple mobile targets that caused build errors.

Copy link
Contributor

@Copilot 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 guards code-versioning, ReJIT, and related debugger/DAC paths with FEATURE_CODE_VERSIONING, adding stubs that return E_NOTIMPL when the feature is absent to prevent build errors on Apple mobile targets where tiered compilation (and thus code versioning) is disabled.

  • Adds FEATURE_CODE_VERSIONING conditionals around code-versioning logic in perfmap, JIT interface, ETW events, debugger, DAC, and RS (debugger) components.
  • Introduces E_NOTIMPL fallbacks for APIs that depend on code versioning when the feature is not compiled.
  • Adjusts data structures and class members to compile cleanly without code versioning support.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/coreclr/vm/perfmap.cpp Wraps native code version resolution in FEATURE_CODE_VERSIONING.
src/coreclr/vm/jitinterface.cpp Guards helper resolution logic that depends on code versioning.
src/coreclr/vm/eventtrace.cpp Adds conditional emission of IL-to-native map and rich debug info events.
src/coreclr/inc/dacvars.h Exposes a DAC variable only when code versioning is enabled.
src/coreclr/debug/inc/dbgipcevents.h Guards VMPTRs for versioning nodes.
src/coreclr/debug/inc/dacdbiinterface.h Conditionally declares IL/native code version node accessors.
src/coreclr/debug/ee/functioninfo.cpp Gates IL map selection and fixes a variable name in a fallback path.
src/coreclr/debug/ee/debugger.h Makes helper method private/public only when feature enabled.
src/coreclr/debug/ee/debugger.cpp Adds guarded behavior and E_NOTIMPL stubs for deoptimization APIs.
src/coreclr/debug/di/rsthread.cpp Guards ReJIT IL code access in value enumeration and frame construction.
src/coreclr/debug/di/rsstackwalk.cpp Conditionally fetches ReJIT IL code during stack walking.
src/coreclr/debug/di/rspriv.h Wraps ReJIT-related forward declarations and members.
src/coreclr/debug/di/rsfunction.cpp Guards ReJIT IL code table and related methods; adds E_NOTIMPL fallback.
src/coreclr/debug/di/module.cpp Wraps CordbReJitILCode implementation.
src/coreclr/debug/daccess/request.cpp Adds guarded implementations with E_NOTIMPL fallbacks for ReJIT queries.
src/coreclr/debug/daccess/dacdbiimpl.h Moves versioning-related declarations under feature flag.
src/coreclr/debug/daccess/dacdbiimpl.cpp Segregates versioning node accessors and reintroduces stubs outside the guard.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ETW::EnumerationLog::EnumerationStructs::JitMethodILToNativeMap,
pNativeCodeStartAddress,
pConfig->GetCodeVersion().GetVersionId(),
0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we this ifdef smaller e.g. by storing the arg in a local and just ifdef the local?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetILCodeVersionId returns 0 when not FEATURE_CODE_VERSIONING, so these ifdefs were removed.

kotlarmilos and others added 4 commits October 17, 2025 09:53
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).


return hr;
#else
return E_NOTIMPL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can succeed with returning *pcMethodDescs = 0;


HRESULT ClrDataAccess::GetProfilerModifiedILInformation(CLRDATA_ADDRESS methodDesc, struct DacpProfilerILData *pILData)
{
#ifdef FEATURE_CODE_VERSIONING
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ifdef can be smaller (just CodeVersionManager* pCodeVersionManager = pMD->GetCodeVersionManager(); block) so that the method succeeds as if there was no code versioning event.

}
}

#ifdef FEATURE_CODE_VERSIONING
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ifdeing code unrelated to the code versioning now. The ifdef should be smaller so that the logging still works as if there was no code versioning event.

m_pReJitCode->ExternalAddRef();
}
#else
return E_NOTIMPL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return NULL instead of E_NOTIMPL?


return hr;
#else
return E_NOTIMPL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just return pReJitData->flags = DacpReJitData2::kActive; - same as with no code versioning?


return hr;
#else
return E_NOTIMPL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return *pRejitId = -1; and hr = S_FALSE;?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants