diff --git a/src/coreclr/vm/codeversion.cpp b/src/coreclr/vm/codeversion.cpp index d8ce701e499898..0333d2d7941422 100644 --- a/src/coreclr/vm/codeversion.cpp +++ b/src/coreclr/vm/codeversion.cpp @@ -1984,6 +1984,9 @@ HRESULT CodeVersionManager::PublishNativeCodeVersion(MethodDesc* pMethod, Native // When we hit the Precode that should fixup any issues with an unset interpreter code pointer. This is notably most important in ReJIT scenarios pMethod->ClearInterpreterCodePointer(); #endif +#ifdef FEATURE_PORTABLE_ENTRYPOINTS + pMethod->ResetPortableEntryPoint(); +#endif // FEATURE_PORTABLE_ENTRYPOINTS #ifdef FEATURE_TIERED_COMPILATION bool wasSet = CallCountingManager::SetCodeEntryPoint(nativeCodeVersion, pCode, false, nullptr); _ASSERTE(wasSet); diff --git a/src/coreclr/vm/finalizerthread.cpp b/src/coreclr/vm/finalizerthread.cpp index e9f701b169316c..4e982c1c527119 100644 --- a/src/coreclr/vm/finalizerthread.cpp +++ b/src/coreclr/vm/finalizerthread.cpp @@ -58,8 +58,7 @@ extern "C" void SystemJS_ExecuteFinalizationCallback() INSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP; { GCX_COOP(); - // TODO-WASM https://github.com/dotnet/runtime/issues/123712 - // ManagedThreadBase::KickOff(FinalizerThread::FinalizerThreadWorkerIteration, NULL); + ManagedThreadBase::KickOff(FinalizerThread::FinalizerThreadWorkerIteration, NULL); } UNINSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP; } diff --git a/src/coreclr/vm/method.cpp b/src/coreclr/vm/method.cpp index 8d07d3155bce32..bb08e6f9c6de63 100644 --- a/src/coreclr/vm/method.cpp +++ b/src/coreclr/vm/method.cpp @@ -2474,6 +2474,18 @@ BOOL MethodDesc::ShouldCallPrestub() #endif // FEATURE_PORTABLE_ENTRYPOINTS } +#ifdef FEATURE_PORTABLE_ENTRYPOINTS +void MethodDesc::ResetPortableEntryPoint() +{ + PCODE tempEntry = GetTemporaryEntryPointIfExists(); + if (tempEntry != (PCODE)NULL) + { + PortableEntryPoint* pep = PortableEntryPoint::ToPortableEntryPoint(tempEntry); + pep->Init(this); // Re-initializes: clears _pActualCode, _pInterpreterData, _flags + } +} +#endif // FEATURE_PORTABLE_ENTRYPOINTS + //******************************************************************************* void MethodDesc::Reset() { @@ -2490,10 +2502,12 @@ void MethodDesc::Reset() // Reset any flags relevant to the old code ClearFlagsOnUpdate(); -#ifndef FEATURE_PORTABLE_ENTRYPOINTS +#ifdef FEATURE_PORTABLE_ENTRYPOINTS + ResetPortableEntryPoint(); +#else // !FEATURE_PORTABLE_ENTRYPOINTS _ASSERTE(HasPrecode()); GetPrecode()->Reset(); -#endif // !FEATURE_PORTABLE_ENTRYPOINTS +#endif // FEATURE_PORTABLE_ENTRYPOINTS if (HasNativeCodeSlot()) { @@ -3276,6 +3290,10 @@ void MethodDesc::ResetCodeEntryPoint() ClearInterpreterCodePointer(); #endif +#ifdef FEATURE_PORTABLE_ENTRYPOINTS + ResetPortableEntryPoint(); +#endif // FEATURE_PORTABLE_ENTRYPOINTS + if (MayHaveEntryPointSlotsToBackpatch()) { BackpatchToResetEntryPointSlots(); @@ -3313,7 +3331,9 @@ void MethodDesc::ResetCodeEntryPointForEnC() #endif LOG((LF_ENC, LL_INFO100000, "MD::RCEPFENC: this:%p - %s::%s\n", this, m_pszDebugClassName, m_pszDebugMethodName)); -#ifndef FEATURE_PORTABLE_ENTRYPOINTS +#ifdef FEATURE_PORTABLE_ENTRYPOINTS + ResetPortableEntryPoint(); +#else // !FEATURE_PORTABLE_ENTRYPOINTS LOG((LF_ENC, LL_INFO100000, "MD::RCEPFENC: HasPrecode():%s, HasNativeCodeSlot():%s\n", (HasPrecode() ? "true" : "false"), (HasNativeCodeSlot() ? "true" : "false"))); if (HasPrecode()) diff --git a/src/coreclr/vm/method.hpp b/src/coreclr/vm/method.hpp index abdd36fc0931f8..c7f43d25b6123d 100644 --- a/src/coreclr/vm/method.hpp +++ b/src/coreclr/vm/method.hpp @@ -1619,6 +1619,8 @@ class MethodDesc void EnsurePortableEntryPoint(); PCODE GetPortableEntryPoint(); + + void ResetPortableEntryPoint(); #endif // FEATURE_PORTABLE_ENTRYPOINTS //*******************************************************************************