summaryrefslogtreecommitdiff
path: root/src/vm/proftoeeinterfaceimpl.cpp
diff options
context:
space:
mode:
authorDavid Mason <davmason@microsoft.com>2019-06-25 20:15:02 -0700
committerGitHub <noreply@github.com>2019-06-25 20:15:02 -0700
commitd344fff2f063aa242c41da6b4a5ee2ddb95e1d6a (patch)
tree4030ad6e6beb8a16e4de2a86f0567f6a9543548e /src/vm/proftoeeinterfaceimpl.cpp
parentb497f76f9ab6a4f351bc9ec24437b0e2c5e4a1af (diff)
downloadcoreclr-d344fff2f063aa242c41da6b4a5ee2ddb95e1d6a.tar.gz
coreclr-d344fff2f063aa242c41da6b4a5ee2ddb95e1d6a.tar.bz2
coreclr-d344fff2f063aa242c41da6b4a5ee2ddb95e1d6a.zip
Fix ReJIT failures (#25377)
Diffstat (limited to 'src/vm/proftoeeinterfaceimpl.cpp')
-rw-r--r--src/vm/proftoeeinterfaceimpl.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp
index f2387232a6..cff17213a7 100644
--- a/src/vm/proftoeeinterfaceimpl.cpp
+++ b/src/vm/proftoeeinterfaceimpl.cpp
@@ -6805,6 +6805,12 @@ HRESULT ProfToEEInterfaceImpl::RequestReJITWithInliners(
// Remember the profiler is doing this, as that means we must never detach it!
g_profControlBlock.pProfInterface->SetUnrevertiblyModifiedILFlag();
+
+ HRESULT hr = SetupThreadForReJIT();
+ if (FAILED(hr))
+ {
+ return hr;
+ }
GCX_PREEMP();
return ReJitManager::RequestReJIT(cFunctions, moduleIds, methodIds, static_cast<COR_PRF_REJIT_FLAGS>(dwRejitFlags));
@@ -8655,6 +8661,27 @@ HRESULT ProfToEEInterfaceImpl::GetReJITIDs(
return ReJitManager::GetReJITIDs(pMD, cReJitIds, pcReJitIds, reJitIds);
}
+
+HRESULT ProfToEEInterfaceImpl::SetupThreadForReJIT()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ HRESULT hr = S_OK;
+ EX_TRY
+ {
+ if (GetThread() == NULL)
+ {
+ SetupThread();
+ }
+
+ Thread *pThread = GetThread();
+ pThread->SetProfilerCallbackStateFlags(COR_PRF_CALLBACKSTATE_REJIT_WAS_CALLED);
+ }
+ EX_CATCH_HRESULT(hr);
+
+ return hr;
+}
+
HRESULT ProfToEEInterfaceImpl::RequestReJIT(ULONG cFunctions, // in
ModuleID moduleIds[], // in
mdMethodDef methodIds[]) // in
@@ -8704,6 +8731,12 @@ HRESULT ProfToEEInterfaceImpl::RequestReJIT(ULONG cFunctions, // in
// Remember the profiler is doing this, as that means we must never detach it!
g_profControlBlock.pProfInterface->SetUnrevertiblyModifiedILFlag();
+ HRESULT hr = SetupThreadForReJIT();
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
GCX_PREEMP();
return ReJitManager::RequestReJIT(cFunctions, moduleIds, methodIds, static_cast<COR_PRF_REJIT_FLAGS>(0));
}
@@ -8761,6 +8794,12 @@ HRESULT ProfToEEInterfaceImpl::RequestRevert(ULONG cFunctions, // in
memset(rgHrStatuses, 0, sizeof(HRESULT) * cFunctions);
_ASSERTE(S_OK == rgHrStatuses[0]);
}
+
+ HRESULT hr = SetupThreadForReJIT();
+ if (FAILED(hr))
+ {
+ return hr;
+ }
GCX_PREEMP();
return ReJitManager::RequestRevert(cFunctions, moduleIds, methodIds, rgHrStatuses);