Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a9ca220
Fix build when tiered compilation is disabled
kotlarmilos Sep 4, 2025
e8864e8
Merge branch 'main' into improvement/clr-interp-build-features
kotlarmilos Sep 4, 2025
425e2a8
Merge branch 'main' into improvement/clr-interp-build-features
kotlarmilos Sep 4, 2025
eb3ad20
Fix build
kotlarmilos Sep 4, 2025
e86025a
Check for precode in JIT helper indirection
kotlarmilos Sep 4, 2025
ca4e4d6
Update src/coreclr/inc/dacvars.h
kotlarmilos Sep 5, 2025
f8ded3f
Update src/coreclr/inc/vptr_list.h
kotlarmilos Sep 5, 2025
51a2896
Update src/coreclr/vm/amd64/asmconstants.h
kotlarmilos Sep 5, 2025
6c0315b
Update src/coreclr/vm/arm/asmconstants.h
kotlarmilos Sep 5, 2025
dbb63c6
Update src/coreclr/vm/arm64/asmconstants.h
kotlarmilos Sep 5, 2025
304332a
Update src/coreclr/vm/eventtrace.cpp
kotlarmilos Sep 5, 2025
cab6136
Update src/coreclr/vm/i386/asmconstants.h
kotlarmilos Sep 5, 2025
d7a3784
Update src/coreclr/vm/loongarch64/asmconstants.h
kotlarmilos Sep 5, 2025
7052a5c
Update src/coreclr/vm/riscv64/asmconstants.h
kotlarmilos Sep 5, 2025
2743a0a
Revert HasPrecode change
kotlarmilos Sep 22, 2025
e524ccc
Merge branch 'main' into improvement/clr-interp-build-features
kotlarmilos Sep 22, 2025
3cd2370
Merge branch 'main' into improvement/clr-interp-build-features
kotlarmilos Sep 22, 2025
99a4ded
Condition FEATURE_ON_STACK_REPLACEMENT tiered compilation
kotlarmilos Sep 23, 2025
6f768ad
Merge branch 'improvement/clr-interp-build-features' of github.com:ko…
kotlarmilos Sep 23, 2025
aed16ca
Add comment
kotlarmilos Sep 23, 2025
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: 1 addition & 4 deletions src/coreclr/clrfeatures.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_MACCATALYST)
set(FEATURE_TIERED_COMPILATION 1)
set(FEATURE_REJIT 1)
endif()

if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_MACCATALYST)
set(FEATURE_JIT 1)
endif()

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ void DacDbiInterfaceImpl::GetSequencePoints(MethodDesc * pMethodDesc,

ULONG32 entryCount;
BOOL success = DebugInfoManager::GetBoundariesAndVars(request,
InfoStoreNew,
InfoStoreNew,
NULL, // allocator
BoundsType::Uninstrumented,
&entryCount, &mapCopy,
Expand Down Expand Up @@ -5515,7 +5515,7 @@ void DacDbiInterfaceImpl::GetContext(VMPTR_Thread vmThread, DT_CONTEXT * pContex
{
UpdateContextFromRegDisp(&tmpRd, &tmpContext);
CopyMemory(pContextBuffer, &tmpContext, sizeof(*pContextBuffer));
pContextBuffer->ContextFlags = DT_CONTEXT_CONTROL
pContextBuffer->ContextFlags = DT_CONTEXT_CONTROL
#if defined(TARGET_AMD64) || defined(TARGET_ARM)
| DT_CONTEXT_INTEGER // DT_CONTEXT_INTEGER is needed to include the frame register on ARM32 and AMD64 architectures
// DT_CONTEXT_CONTROL already includes the frame register for X86 and ARM64 architectures
Expand Down Expand Up @@ -7196,7 +7196,7 @@ HRESULT DacDbiInterfaceImpl::AreOptimizationsDisabled(VMPTR_Module vmModule, mdM
*pOptimizationsDisabled = activeILVersion.IsDeoptimized();
}
#else
pOptimizationsDisabled->SetDacTargetPtr(0);
*pOptimizationsDisabled = FALSE;
#endif

return S_OK;
Expand Down Expand Up @@ -7339,7 +7339,7 @@ HRESULT DacDbiInterfaceImpl::GetDomainAssemblyFromModule(VMPTR_Module vmModule,
pVmDomainAssembly->SetHostPtr(pModule->GetDomainAssembly());

return S_OK;
}
}

DacRefWalker::DacRefWalker(ClrDataAccess *dac, BOOL walkStacks, BOOL walkFQ, UINT32 handleMask, BOOL resolvePointers)
: mDac(dac), mWalkStacks(walkStacks), mWalkFQ(walkFQ), mHandleMask(handleMask), mStackWalker(NULL),
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/inc/dacvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ DEFINE_DACVAR(PTR_StubLinkStubManager, StubLinkStubManager__g_pManager, StubLink
DEFINE_DACVAR(PTR_JumpStubStubManager, JumpStubStubManager__g_pManager, JumpStubStubManager::g_pManager)
DEFINE_DACVAR(PTR_RangeSectionStubManager, RangeSectionStubManager__g_pManager, RangeSectionStubManager::g_pManager)
DEFINE_DACVAR(PTR_VirtualCallStubManagerManager, VirtualCallStubManagerManager__g_pManager, VirtualCallStubManagerManager::g_pManager)
#ifdef FEATURE_TIERED_COMPILATION
DEFINE_DACVAR(PTR_CallCountingStubManager, CallCountingStubManager__g_pManager, CallCountingStubManager::g_pManager)
#endif // FEATURE_TIERED_COMPILATION

DEFINE_DACVAR(PTR_ThreadStore, ThreadStore__s_pThreadStore, ThreadStore::s_pThreadStore)

Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/inc/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@

#elif defined(TARGET_64BIT)

#define FEATURE_ON_STACK_REPLACEMENT
#ifdef FEATURE_TIERED_COMPILATION
// FEATURE_ON_STACK_REPLACEMENT is only needed for tiered compilation.
#define FEATURE_ON_STACK_REPLACEMENT
#endif // FEATURE_TIERED_COMPILATION

#if defined(HOST_UNIX)
// In PAL we have a mechanism that reserves memory on start up that is
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/inc/vptr_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ VPTR_CLASS(InteropDispatchStubManager)
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
VPTR_CLASS(TailCallStubManager)
#endif
#ifdef FEATURE_TIERED_COMPILATION
VPTR_CLASS(CallCountingStubManager)
#endif // FEATURE_TIERED_COMPILATION

VPTR_CLASS(PEImageLayout)
VPTR_CLASS(ConvertedImageLayout)
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/amd64/asmconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecode
#define StubPrecodeData__SecretParam 0x00
ASMCONSTANTS_C_ASSERT(StubPrecodeData__SecretParam == offsetof(StubPrecodeData, SecretParam))

#ifdef FEATURE_TIERED_COMPILATION
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))

Expand All @@ -546,6 +547,7 @@ ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCoun

#define CallCountingStubData__TargetForThresholdReached 0x10
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#endif // FEATURE_TIERED_COMPILATION

#ifdef FEATURE_CACHED_INTERFACE_DISPATCH
#define OFFSETOF__InterfaceDispatchCache__m_rgEntries 0x20
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/vm/amd64/thunktemplates.S
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ LEAF_END_MARKED StubPrecodeCodeTemplate, _TEXT
// FixupPrecode
// ----------

#define FIXUP_PRECODE_CODESIZE 0x18
#define FIXUP_PRECODE_CODESIZE 0x18
#define FIXUP_PRECODE_DATASIZE 0x18 // 3 qwords
.set FIXUP_PRECODE_NUM_THUNKS_PER_MAPPING,(THUNKS_MAP_SIZE / FIXUP_PRECODE_CODESIZE)

Expand Down Expand Up @@ -101,6 +101,7 @@ LEAF_ENTRY FixupPrecodeCodeTemplate
int 3
LEAF_END_MARKED FixupPrecodeCodeTemplate, _TEXT

#ifdef FEATURE_TIERED_COMPILATION
// ----------
// CallCountingStub
// ----------
Expand Down Expand Up @@ -144,6 +145,7 @@ LEAF_ENTRY CallCountingStubCodeTemplate
int 3
int 3
LEAF_END_MARKED CallCountingStubCodeTemplate, _TEXT
#endif // FEATURE_TIERED_COMPILATION

#endif

Expand All @@ -168,6 +170,7 @@ PATCH_LABEL FixupPrecodeCode_Fixup
jmp [rip + DATA_SLOT(FixupPrecode, PrecodeFixupThunk)]
LEAF_END_MARKED FixupPrecodeCode, _TEXT

#ifdef FEATURE_TIERED_COMPILATION
LEAF_ENTRY CallCountingStubCode, _TEXT
mov rax,QWORD PTR [rip + DATA_SLOT(CallCountingStub, RemainingCallCountCell)]
dec WORD PTR [rax]
Expand All @@ -176,3 +179,4 @@ LEAF_ENTRY CallCountingStubCode, _TEXT
LOCAL_LABEL(CountReachedZero):
jmp QWORD PTR [rip + DATA_SLOT(CallCountingStub, TargetForThresholdReached)]
LEAF_END_MARKED CallCountingStubCode, _TEXT
#endif // FEATURE_TIERED_COMPILATION
2 changes: 2 additions & 0 deletions src/coreclr/vm/arm/asmconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ ASMCONSTANTS_C_ASSERT(StubPrecodeData__SecretParam == offsetof(StubPrecodeData,
#define StubPrecodeData__Target 0x04
ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecodeData, Target))

#ifdef FEATURE_TIERED_COMPILATION
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))

Expand All @@ -195,6 +196,7 @@ ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCoun

#define CallCountingStubData__TargetForThresholdReached 0x08
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#endif // FEATURE_TIERED_COMPILATION

#ifdef PROFILING_SUPPORTED
#define PROFILE_ENTER 0x1
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/arm64/asmconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecode
#define StubPrecodeData__SecretParam 0x00
ASMCONSTANTS_C_ASSERT(StubPrecodeData__SecretParam == offsetof(StubPrecodeData, SecretParam))

#ifdef FEATURE_TIERED_COMPILATION
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))

Expand All @@ -282,6 +283,7 @@ ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCoun

#define CallCountingStubData__TargetForThresholdReached 0x10
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#endif // FEATURE_TIERED_COMPILATION

#ifdef FEATURE_CACHED_INTERFACE_DISPATCH
#define OFFSETOF__InterfaceDispatchCache__m_rgEntries 0x20
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/vm/arm64/asmhelpers.S
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,10 @@ NESTED_ENTRY OnCallCountThresholdReachedStub, _TEXT, NoHandler
EPILOG_BRANCH_REG x9
NESTED_END OnCallCountThresholdReachedStub, _TEXT

#endif // FEATURE_TIERED_COMPILATION

#ifdef FEATURE_ON_STACK_REPLACEMENT

NESTED_ENTRY JIT_Patchpoint, _TEXT, NoHandler
PROLOG_WITH_TRANSITION_BLOCK

Expand All @@ -595,7 +599,7 @@ LEAF_ENTRY JIT_PatchpointForced, _TEXT
b C_FUNC(JIT_Patchpoint)
LEAF_END JIT_PatchpointForced, _TEXT

#endif // FEATURE_TIERED_COMPILATION
#endif // FEATURE_ON_STACK_REPLACEMENT

LEAF_ENTRY JIT_ValidateIndirectCall, _TEXT
ret lr
Expand Down
8 changes: 6 additions & 2 deletions src/coreclr/vm/arm64/thunktemplates.S
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ LEAF_END_MARKED StubPrecodeCodeTemplate, _TEXT
dmb ishld
ldr x12, DATA_SLOT(FixupPrecode, MethodDesc, FIXUP_PRECODE_CODESIZE, FixupPrecodeCodeTemplate)
ldr x11, DATA_SLOT(FixupPrecode, PrecodeFixupThunk, FIXUP_PRECODE_CODESIZE, FixupPrecodeCodeTemplate)
br x11
br x11

IN_PAGE_INDEX = IN_PAGE_INDEX + 1
.endr
Expand All @@ -77,6 +77,7 @@ LEAF_ENTRY FixupPrecodeCodeTemplate
THUNKS_BLOCK_FIXUP_PRECODE
LEAF_END_MARKED FixupPrecodeCodeTemplate, _TEXT

#ifdef FEATURE_TIERED_COMPILATION
// ----------
// CallCountingStub
// ----------
Expand Down Expand Up @@ -110,6 +111,7 @@ LEAF_END_MARKED FixupPrecodeCodeTemplate, _TEXT
LEAF_ENTRY CallCountingStubCodeTemplate
THUNKS_BLOCK_CALLCOUNTING
LEAF_END_MARKED CallCountingStubCodeTemplate, _TEXT
#endif // FEATURE_TIERED_COMPILATION
#endif

#ifdef DATA_SLOT
Expand All @@ -134,9 +136,10 @@ LEAF_END_MARKED CallCountingStubCodeTemplate, _TEXT
dmb ishld
ldr x12, DATA_SLOT(FixupPrecode, MethodDesc)
ldr x11, DATA_SLOT(FixupPrecode, PrecodeFixupThunk)
br x11
br x11
LEAF_END_MARKED FixupPrecodeCode\STUB_PAGE_SIZE

#ifdef FEATURE_TIERED_COMPILATION
LEAF_ENTRY CallCountingStubCode\STUB_PAGE_SIZE
LOCAL_LABEL(StubStart\STUB_PAGE_SIZE):
ldr x9, DATA_SLOT(CallCountingStub, RemainingCallCountCell)
Expand All @@ -151,5 +154,6 @@ LOCAL_LABEL(CountReachedZero\STUB_PAGE_SIZE):
br x10
brk 0xf000 // Stubs need to be aligned in total size
LEAF_END_MARKED CallCountingStubCode\STUB_PAGE_SIZE
#endif // FEATURE_TIERED_COMPILATION

.endr
5 changes: 4 additions & 1 deletion src/coreclr/vm/eventtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1925,10 +1925,12 @@ VOID ETW::EnumerationLog::SendOneTimeRundownEvents()
// Fire the runtime information event
ETW::InfoLog::RuntimeInformation(ETW::InfoLog::InfoStructs::Callback);

#if defined(FEATURE_TIERED_COMPILATION)
if (ETW::CompilationLog::TieredCompilation::Rundown::IsEnabled() && g_pConfig->TieredCompilation())
{
ETW::CompilationLog::TieredCompilation::Rundown::SendSettings();
}
#endif // FEATURE_TIERED_COMPILATION
}


Expand Down Expand Up @@ -5443,6 +5445,7 @@ VOID ETW::EnumerationLog::EnumerationHelper(Module *moduleFilter, DWORD enumerat
}
}

#if defined(FEATURE_TIERED_COMPILATION)
void ETW::CompilationLog::TieredCompilation::GetSettings(UINT32 *flagsRef)
{
CONTRACTL {
Expand Down Expand Up @@ -5484,7 +5487,6 @@ void ETW::CompilationLog::TieredCompilation::GetSettings(UINT32 *flagsRef)
#endif
*flagsRef = flags;
}

void ETW::CompilationLog::TieredCompilation::Runtime::SendSettings()
{
CONTRACTL {
Expand Down Expand Up @@ -5556,6 +5558,7 @@ void ETW::CompilationLog::TieredCompilation::Runtime::SendBackgroundJitStop(UINT

FireEtwTieredCompilationBackgroundJitStop(GetClrInstanceId(), pendingMethodCount, jittedMethodCount);
}
#endif // FEATURE_TIERED_COMPILATION

#endif // !FEATURE_NATIVEAOT

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/i386/asmconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecode
#define StubPrecodeData__SecretParam 0x00
ASMCONSTANTS_C_ASSERT(StubPrecodeData__SecretParam == offsetof(StubPrecodeData, SecretParam))

#ifdef FEATURE_TIERED_COMPILATION
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))

Expand All @@ -309,6 +310,7 @@ ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCoun

#define CallCountingStubData__TargetForThresholdReached 0x08
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#endif // FEATURE_TIERED_COMPILATION

#undef ASMCONSTANTS_C_ASSERT
#undef ASMCONSTANTS_RUNTIME_ASSERT
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/i386/thunktemplates.S
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SLOT_ADDRESS_PATCH_LABEL FixupPrecode, MethodDesc
SLOT_ADDRESS_PATCH_LABEL FixupPrecode, PrecodeFixupThunk
LEAF_END_MARKED FixupPrecodeCode

#ifdef FEATURE_TIERED_COMPILATION
LEAF_ENTRY CallCountingStubCode
mov eax, dword ptr [DATA_SLOT(CallCountingStub, RemainingCallCountCell)]
SLOT_ADDRESS_PATCH_LABEL CallCountingStub, RemainingCallCountCell
Expand All @@ -55,3 +56,4 @@ LOCAL_LABEL(CountReachedZero):
INDJMP DATA_SLOT(CallCountingStub, TargetForThresholdReached)
SLOT_ADDRESS_PATCH_LABEL CallCountingStub, TargetForThresholdReached
LEAF_END_MARKED CallCountingStubCode
#endif // FEATURE_TIERED_COMPILATION
2 changes: 2 additions & 0 deletions src/coreclr/vm/loongarch64/asmconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecode
#define StubPrecodeData__SecretParam 0x00
ASMCONSTANTS_C_ASSERT(StubPrecodeData__SecretParam == offsetof(StubPrecodeData, SecretParam))

#ifdef FEATURE_TIERED_COMPILATION
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))

Expand All @@ -227,6 +228,7 @@ ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCoun

#define CallCountingStubData__TargetForThresholdReached 0x10
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#endif // FEATURE_TIERED_COMPILATION

#ifdef PROFILING_SUPPORTED
#define PROFILE_ENTER 1
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/vm/loongarch64/asmhelpers.S
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,10 @@ NESTED_ENTRY OnCallCountThresholdReachedStub, _TEXT, NoHandler
EPILOG_BRANCH_REG $t4
NESTED_END OnCallCountThresholdReachedStub, _TEXT

#endif // FEATURE_TIERED_COMPILATION

#ifdef FEATURE_ON_STACK_REPLACEMENT

NESTED_ENTRY JIT_Patchpoint, _TEXT, NoHandler
PROLOG_WITH_TRANSITION_BLOCK

Expand All @@ -965,7 +969,7 @@ LEAF_ENTRY JIT_PatchpointForced, _TEXT
b C_FUNC(JIT_Patchpoint)
LEAF_END JIT_PatchpointForced, _TEXT

#endif // FEATURE_TIERED_COMPILATION
#endif // FEATURE_ON_STACK_REPLACEMENT

// ------------------------------------------------------------------
// size_t GetThreadStaticsVariableOffset()
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/loongarch64/thunktemplates.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ LEAF_ENTRY FixupPrecodeCode
jirl $r0,$r21,0
LEAF_END_MARKED FixupPrecodeCode

#ifdef FEATURE_TIERED_COMPILATION
// NOTE: For LoongArch64 `CallCountingStubData__RemainingCallCountCell` must be zero !!!
// Because the stub-identifying token is $t1 within the `OnCallCountThresholdReachedStub`.
LEAF_ENTRY CallCountingStubCode
Expand All @@ -39,3 +40,4 @@ LOCAL_LABEL(CountReachedZero):
ld.d $r21, $t2, CallCountingStubData__TargetForThresholdReached
jirl $r0,$r21,0
LEAF_END_MARKED CallCountingStubCode
#endif // FEATURE_TIERED_COMPILATION
2 changes: 2 additions & 0 deletions src/coreclr/vm/riscv64/asmconstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecode
#define StubPrecodeData__SecretParam 0x00
ASMCONSTANTS_C_ASSERT(StubPrecodeData__SecretParam == offsetof(StubPrecodeData, SecretParam))

#ifdef FEATURE_TIERED_COMPILATION
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))

Expand All @@ -228,6 +229,7 @@ ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCoun

#define CallCountingStubData__TargetForThresholdReached 0x10
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#endif // FEATURE_TIERED_COMPILATION

#ifdef PROFILING_SUPPORTED
#define PROFILE_ENTER 1
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/vm/riscv64/asmhelpers.S
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,10 @@ NESTED_ENTRY OnCallCountThresholdReachedStub, _TEXT, NoHandler
EPILOG_BRANCH_REG t4
NESTED_END OnCallCountThresholdReachedStub, _TEXT

#endif // FEATURE_TIERED_COMPILATION

#ifdef FEATURE_ON_STACK_REPLACEMENT

NESTED_ENTRY JIT_Patchpoint, _TEXT, NoHandler
PROLOG_WITH_TRANSITION_BLOCK

Expand All @@ -838,7 +842,7 @@ LEAF_ENTRY JIT_PatchpointForced, _TEXT
j C_FUNC(JIT_Patchpoint)
LEAF_END JIT_PatchpointForced, _TEXT

#endif // FEATURE_TIERED_COMPILATION
#endif // FEATURE_ON_STACK_REPLACEMENT

// ------------------------------------------------------------------
// size_t GetThreadStaticsVariableOffset()
Expand Down