Skip to content

Commit a83d76a

Browse files
[clr-interp] Enable rejit in the interpreter (#122626)
- Rely on resetting the interpreter code pointer to trigger the existing rejit/prestub logic to fill in any gaps we have. This fixes the rejit test --------- Co-authored-by: Copilot <[email protected]>
1 parent a6c5ba3 commit a83d76a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/coreclr/vm/codeversion.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,11 @@ HRESULT CodeVersionManager::PublishNativeCodeVersion(MethodDesc* pMethod, Native
19801980
pMethod,
19811981
nativeCodeVersion.GetVersionId()));
19821982

1983-
#ifdef FEATURE_TIERED_COMPILATION
1983+
#ifdef FEATURE_INTERPRETER
1984+
// When we hit the Precode that should fixup any issues with an unset interpreter code pointer. This is notably most important in ReJIT scenarios
1985+
pMethod->ClearInterpreterCodePointer();
1986+
#endif
1987+
#ifdef FEATURE_TIERED_COMPILATION
19841988
bool wasSet = CallCountingManager::SetCodeEntryPoint(nativeCodeVersion, pCode, false, nullptr);
19851989
_ASSERTE(wasSet);
19861990
#else

src/coreclr/vm/method.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3233,6 +3233,10 @@ void MethodDesc::ResetCodeEntryPoint()
32333233
WRAPPER_NO_CONTRACT;
32343234
_ASSERTE(IsVersionable());
32353235

3236+
#ifdef FEATURE_INTERPRETER
3237+
ClearInterpreterCodePointer();
3238+
#endif
3239+
32363240
if (MayHaveEntryPointSlotsToBackpatch())
32373241
{
32383242
BackpatchToResetEntryPointSlots();
@@ -3265,6 +3269,10 @@ void MethodDesc::ResetCodeEntryPointForEnC()
32653269
return;
32663270
}
32673271

3272+
#ifdef FEATURE_INTERPRETER
3273+
ClearInterpreterCodePointer();
3274+
#endif
3275+
32683276
LOG((LF_ENC, LL_INFO100000, "MD::RCEPFENC: this:%p - %s::%s\n", this, m_pszDebugClassName, m_pszDebugMethodName));
32693277
#ifndef FEATURE_PORTABLE_ENTRYPOINTS
32703278
LOG((LF_ENC, LL_INFO100000, "MD::RCEPFENC: HasPrecode():%s, HasNativeCodeSlot():%s\n",

0 commit comments

Comments
 (0)