Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1bbc362
Initial plan
Copilot Apr 2, 2026
e778fc2
Disable FEATURE_PGO on WebAssembly and iOS/MacCatalyst builds
Copilot Apr 3, 2026
9a5faea
Move FEATURE_PGO into FEATURE_DYNAMIC_CODE_COMPILED block per review …
Copilot Apr 3, 2026
48400c1
Apply suggestion from @jkotas
jkotas Apr 3, 2026
9154475
Apply suggestion from @jkotas
jkotas Apr 3, 2026
bd0fad9
Update src/coreclr/clrdefinitions.cmake
jkotas Apr 3, 2026
41eb113
Apply suggestion from @jkotas
jkotas Apr 3, 2026
41d2e08
Fix pgo.cpp stub signatures for !FEATURE_PGO builds
Copilot Apr 3, 2026
4d8e57c
Fix more !FEATURE_PGO build failures: guard TieredPGO calls and PGO h…
Copilot Apr 3, 2026
174b888
Merge branch 'main' into copilot/remove-pgo-infrastructure
AaronRobinsonMSFT Apr 4, 2026
799c878
Move FEATURE_CORPROFILER into FEATURE_DYNAMIC_CODE_COMPILED block in …
Copilot Apr 4, 2026
6c83bc4
Revert FEATURE_CORPROFILER into FEATURE_DYNAMIC_CODE_COMPILED block (…
Copilot Apr 4, 2026
0b1047e
Merge branch 'main' into copilot/remove-pgo-infrastructure
jkotas Apr 4, 2026
e9fb096
Make PGO JIT helper table entries conditional on FEATURE_PGO
Copilot Apr 5, 2026
b410836
Merge branch 'main' into copilot/remove-pgo-infrastructure
jkotas Apr 7, 2026
941d978
Update src/coreclr/vm/pgo.cpp
jkotas Apr 8, 2026
d8e3859
Apply suggestion from @jkotas
jkotas Apr 8, 2026
beca869
Apply suggestion from @Copilot
jkotas Apr 8, 2026
81fe85d
Apply suggestion from @jkotas
jkotas Apr 8, 2026
d69736b
Update src/coreclr/vm/jitinterface.cpp
jkotas Apr 8, 2026
283f203
Fix getPgoInstrumentationResults stub missing *ppSchema=NULL init and…
Copilot Apr 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/coreclr/clrdefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ if (FEATURE_TIERED_COMPILATION)
add_compile_definitions(FEATURE_TIERED_COMPILATION)
endif(FEATURE_TIERED_COMPILATION)

add_compile_definitions(FEATURE_PGO)
if (FEATURE_PGO)
add_compile_definitions(FEATURE_PGO)
endif(FEATURE_PGO)

Comment thread
jkotas marked this conversation as resolved.
if (CLR_CMAKE_TARGET_ARCH_AMD64)
# Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit.
add_definitions(-DUNIX_AMD64_ABI_ITF)
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/clrfeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ endif()
if (FEATURE_DYNAMIC_CODE_COMPILED)
set(FEATURE_TIERED_COMPILATION 1)
set(FEATURE_REJIT 1)
set(FEATURE_PGO 1)
endif()
Comment thread
jkotas marked this conversation as resolved.

# On desktop, if dynamic code compiled is false, we still enable static linking so we don't have to add platform manifest entries
Expand Down
13 changes: 13 additions & 0 deletions src/coreclr/inc/jithelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
JITHELPER(CORINFO_HELP_PATCHPOINT, JIT_Patchpoint, METHOD__NIL)
JITHELPER(CORINFO_HELP_PATCHPOINT_FORCED, JIT_PatchpointForced, METHOD__NIL)

#ifdef FEATURE_PGO
JITHELPER(CORINFO_HELP_CLASSPROFILE32, JIT_ClassProfile32, METHOD__NIL)
JITHELPER(CORINFO_HELP_CLASSPROFILE64, JIT_ClassProfile64, METHOD__NIL)
JITHELPER(CORINFO_HELP_DELEGATEPROFILE32, JIT_DelegateProfile32, METHOD__NIL)
Expand All @@ -339,6 +340,18 @@
JITHELPER(CORINFO_HELP_COUNTPROFILE64, JIT_CountProfile64, METHOD__NIL)
JITHELPER(CORINFO_HELP_VALUEPROFILE32, JIT_ValueProfile32, METHOD__NIL)
JITHELPER(CORINFO_HELP_VALUEPROFILE64, JIT_ValueProfile64, METHOD__NIL)
#else
JITHELPER(CORINFO_HELP_CLASSPROFILE32, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_CLASSPROFILE64, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_DELEGATEPROFILE32, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_DELEGATEPROFILE64, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_VTABLEPROFILE32, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_VTABLEPROFILE64, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_COUNTPROFILE32, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_COUNTPROFILE64, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_VALUEPROFILE32, NULL, METHOD__NIL)
JITHELPER(CORINFO_HELP_VALUEPROFILE64, NULL, METHOD__NIL)
#endif

#if defined(TARGET_AMD64) || defined(TARGET_ARM64)
JITHELPER(CORINFO_HELP_VALIDATE_INDIRECT_CALL, JIT_ValidateIndirectCall, METHOD__NIL)
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,8 @@ HCIMPLEND

#endif // FEATURE_ON_STACK_REPLACEMENT

#ifdef FEATURE_PGO

static unsigned HandleHistogramProfileRand()
{
// Generate a random number (xorshift32)
Expand Down Expand Up @@ -2179,6 +2181,8 @@ HCIMPL1(void, JIT_CountProfile64, volatile LONG64* pCounter)
}
HCIMPLEND

#endif // FEATURE_PGO

//========================================================================
//
// INTEROP HELPERS
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12717,10 +12717,15 @@ HRESULT CEEJitInfo::getPgoInstrumentationResults(
} CONTRACTL_END;

HRESULT hr = E_FAIL;
*pSchema = NULL;
*pCountSchemaItems = 0;
Comment thread
jkotas marked this conversation as resolved.
*pInstrumentationData = NULL;
*pPgoSource = PgoSource::Unknown;
#ifdef FEATURE_PGO
*pDynamicPgo = g_pConfig->TieredPGO();
#else
*pDynamicPgo = false;
#endif

JIT_TO_EE_TRANSITION();

Expand Down
24 changes: 22 additions & 2 deletions src/coreclr/vm/pgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,9 +1230,29 @@ HRESULT PgoManager::allocPgoInstrumentationBySchema(MethodDesc* pMD, ICorJitInfo

// Stub version for !FEATURE_PGO builds
//
HRESULT PgoManager::getPgoInstrumentationResults(MethodDesc* pMD, NewArrayHolder<BYTE> *pAllocatedData, ICorJitInfo::PgoInstrumentationSchema** ppSchema, UINT32 *pCountSchemaItems, BYTE**pInstrumentationData)
HRESULT PgoManager::getPgoInstrumentationResultsFromR2RFormat(ReadyToRunInfo *pReadyToRunInfo,
Module* pModule,
ReadyToRunLoadedImage* pNativeImage,
BYTE* pR2RFormatData,
size_t pR2RFormatDataMaxSize,
BYTE** pAllocatedData,
ICorJitInfo::PgoInstrumentationSchema** ppSchema,
UINT32 *pCountSchemaItems,
BYTE**pInstrumentationData)
{
*pAllocatedData = NULL;
Comment thread
jkotas marked this conversation as resolved.
*ppSchema = NULL;
*pCountSchemaItems = 0;
*pInstrumentationData = NULL;
return E_NOTIMPL;
}
Comment thread
jkotas marked this conversation as resolved.

// Stub version for !FEATURE_PGO builds
//
HRESULT PgoManager::getPgoInstrumentationResults(MethodDesc* pMD, BYTE **pAllocatedData, ICorJitInfo::PgoInstrumentationSchema** ppSchema, UINT32 *pCountSchemaItems, BYTE**pInstrumentationData, ICorJitInfo::PgoSource* pPgoSource)
{
*pAllocatedData = NULL;
*ppSchema = NULL;
*pCountSchemaItems = 0;
*pInstrumentationData = NULL;
return E_NOTIMPL;
Expand All @@ -1244,7 +1264,7 @@ void PgoManager::VerifyAddress(void* address)

// Stub version for !FEATURE_PGO builds
//
void PgoManager::CreatePgoManager(PgoManager** ppMgr, bool loaderAllocator)
void PgoManager::CreatePgoManager(PgoManager* volatile* ppMgr, bool loaderAllocator)
Comment thread
jkotas marked this conversation as resolved.
{
*ppMgr = NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/pgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PgoManager

public:

static HRESULT getPgoInstrumentationResults(MethodDesc* pMD, BYTE **pAllocatedDatapAllocatedData, ICorJitInfo::PgoInstrumentationSchema** ppSchema, UINT32 *pCountSchemaItems, BYTE**pInstrumentationData, ICorJitInfo::PgoSource* pPgoSource);
static HRESULT getPgoInstrumentationResults(MethodDesc* pMD, BYTE **pAllocatedData, ICorJitInfo::PgoInstrumentationSchema** ppSchema, UINT32 *pCountSchemaItems, BYTE**pInstrumentationData, ICorJitInfo::PgoSource* pPgoSource);
static HRESULT allocPgoInstrumentationBySchema(MethodDesc* pMD, ICorJitInfo::PgoInstrumentationSchema* pSchema, UINT32 countSchemaItems, BYTE** pInstrumentationData);
static HRESULT getPgoInstrumentationResultsFromR2RFormat(ReadyToRunInfo *pReadyToRunInfo,
Module* pModule,
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/tieredcompilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ CORJIT_FLAGS TieredCompilationManager::GetJitFlags(PrepareCodeConfig *config)
case NativeCodeVersion::OptimizationTier0:
if (g_pConfig->TieredCompilation_QuickJit())
{
#ifdef FEATURE_PGO
if (g_pConfig->TieredPGO() && g_pConfig->TieredPGO_InstrumentOnlyHotCode())
{
// If we plan to only instrument hot code we have to make an exception
Expand All @@ -1057,6 +1058,7 @@ CORJIT_FLAGS TieredCompilationManager::GetJitFlags(PrepareCodeConfig *config)
// if current method has loops and is eligible for OSR.
flags.Set(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR_IF_LOOPS);
}
#endif
flags.Set(CORJIT_FLAGS::CORJIT_FLAG_TIER0);
break;
}
Expand Down
Loading