summaryrefslogtreecommitdiff
path: root/src/vm/proftoeeinterfaceimpl.cpp
diff options
context:
space:
mode:
authornoahfalk <noahfalk@microsoft.com>2017-07-24 17:38:30 -0700
committernoahfalk <noahfalk@microsoft.com>2017-07-24 17:38:30 -0700
commitfd1998903d5eef356f27c54e5a9d490711cbc9e7 (patch)
treeb1d3d7ff1978483060a0f7c879b22006edd417b4 /src/vm/proftoeeinterfaceimpl.cpp
parent39cd3cfcb078154f9b595ae476f2c5fb7b445e18 (diff)
downloadcoreclr-fd1998903d5eef356f27c54e5a9d490711cbc9e7.tar.gz
coreclr-fd1998903d5eef356f27c54e5a9d490711cbc9e7.tar.bz2
coreclr-fd1998903d5eef356f27c54e5a9d490711cbc9e7.zip
Add the runtime code versioning feature
This makes tiered compilation work properly with profiler ReJIT, and positions the runtime to integrate other versioning related features together in the future. See the newly added code-versioning design-doc in this commit for more information. Breaking changes for profilers: See code-versioning-profiler-breaking-changes.md for more details.
Diffstat (limited to 'src/vm/proftoeeinterfaceimpl.cpp')
-rw-r--r--src/vm/proftoeeinterfaceimpl.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp
index cfd99adf27..0493163287 100644
--- a/src/vm/proftoeeinterfaceimpl.cpp
+++ b/src/vm/proftoeeinterfaceimpl.cpp
@@ -2117,7 +2117,7 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromIP2(LPCBYTE ip, FunctionID * pFunc
if (pReJitId != NULL)
{
MethodDesc * pMD = codeInfo.GetMethodDesc();
- *pReJitId = pMD->GetReJitManager()->GetReJitId(pMD, codeInfo.GetStartAddress());
+ *pReJitId = ReJitManager::GetReJitId(pMD, codeInfo.GetStartAddress());
}
return S_OK;
@@ -2592,13 +2592,24 @@ HRESULT ProfToEEInterfaceImpl::GetCodeInfo3(FunctionID functionId,
hr = ValidateParametersForGetCodeInfo(pMethodDesc, cCodeInfos, codeInfos);
if (SUCCEEDED(hr))
{
- hr = GetCodeInfoFromCodeStart(
- // Note here that we must consult the rejit manager to determine the code
- // start address
- pMethodDesc->GetReJitManager()->GetCodeStart(pMethodDesc, reJitId),
- cCodeInfos,
- pcCodeInfos,
- codeInfos);
+ CodeVersionManager* pCodeVersionManager = pMethodDesc->GetCodeVersionManager();
+ ILCodeVersion ilCodeVersion = pCodeVersionManager->GetILCodeVersion(pMethodDesc, reJitId);
+
+ // Now that tiered compilation can create more than one jitted code version for the same rejit id
+ // we are arbitrarily choosing the first one to return. To return all of them we'd presumably need
+ // a new profiler API.
+ NativeCodeVersionCollection nativeCodeVersions = ilCodeVersion.GetNativeCodeVersions(pMethodDesc);
+ for (NativeCodeVersionIterator iter = nativeCodeVersions.Begin(); iter != nativeCodeVersions.End(); iter++)
+ {
+ PCODE pCodeStart = iter->GetNativeCode();
+ hr = GetCodeInfoFromCodeStart(
+ pCodeStart,
+ cCodeInfos,
+ pcCodeInfos,
+ codeInfos);
+ break;
+ }
+
}
}
EX_CATCH_HRESULT(hr);
@@ -6425,7 +6436,7 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromIP3(LPCBYTE ip, FunctionID * pFunc
if (pReJitId != NULL)
{
MethodDesc * pMD = codeInfo.GetMethodDesc();
- *pReJitId = pMD->GetReJitManager()->GetReJitId(pMD, codeInfo.GetStartAddress());
+ *pReJitId = ReJitManager::GetReJitId(pMD, codeInfo.GetStartAddress());
}
return S_OK;
@@ -8239,7 +8250,7 @@ HRESULT ProfToEEInterfaceImpl::GetReJITIDs(
MethodDesc * pMD = FunctionIdToMethodDesc(functionId);
- return pMD->GetReJitManager()->GetReJITIDs(pMD, cReJitIds, pcReJitIds, reJitIds);
+ return ReJitManager::GetReJITIDs(pMD, cReJitIds, pcReJitIds, reJitIds);
}
HRESULT ProfToEEInterfaceImpl::RequestReJIT(ULONG cFunctions, // in