Skip to content

Commit 7905f0e

Browse files
rcj1Rachel Jarvi
andauthored
adding GetPendingReJITID cDAC API (#117533)
Co-authored-by: Rachel Jarvi <[email protected]>
1 parent 19a9b70 commit 7905f0e

File tree

1 file changed

+40
-1
lines changed
  • src/native/managed/cdac/mscordaccore_universal/Legacy

1 file changed

+40
-1
lines changed

src/native/managed/cdac/mscordaccore_universal/Legacy/SOSDacImpl.cs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,46 @@ int ISOSDacInterface6.GetMethodTableCollectibleData(ClrDataAddress mt, /*struct
17891789

17901790
#region ISOSDacInterface7
17911791
int ISOSDacInterface7.GetPendingReJITID(ClrDataAddress methodDesc, int* pRejitId)
1792-
=> _legacyImpl7 is not null ? _legacyImpl7.GetPendingReJITID(methodDesc, pRejitId) : HResults.E_NOTIMPL;
1792+
{
1793+
if (methodDesc == 0 || pRejitId == null)
1794+
return HResults.E_INVALIDARG;
1795+
1796+
int hr = HResults.S_OK;
1797+
try
1798+
{
1799+
Contracts.IReJIT rejitContract = _target.Contracts.ReJIT;
1800+
Contracts.ICodeVersions codeVersionsContract = _target.Contracts.CodeVersions;
1801+
TargetPointer methodDescPtr = methodDesc.ToTargetPointer(_target);
1802+
Contracts.ILCodeVersionHandle activeILCodeVersion = codeVersionsContract.GetActiveILCodeVersion(methodDescPtr);
1803+
1804+
if (rejitContract.GetRejitState(activeILCodeVersion) == Contracts.RejitState.Requested)
1805+
{
1806+
*pRejitId = (int)rejitContract.GetRejitId(activeILCodeVersion).Value;
1807+
}
1808+
else
1809+
{
1810+
hr = HResults.S_FALSE;
1811+
}
1812+
}
1813+
catch (System.Exception ex)
1814+
{
1815+
hr = ex.HResult;
1816+
}
1817+
#if DEBUG
1818+
if (_legacyImpl7 is not null)
1819+
{
1820+
int rejitIdLocal;
1821+
int hrLocal = _legacyImpl7.GetPendingReJITID(methodDesc, &rejitIdLocal);
1822+
Debug.Assert(hrLocal == hr, $"cDAC: {hr:x}, DAC: {hrLocal:x}");
1823+
if (hr == HResults.S_OK)
1824+
{
1825+
Debug.Assert(*pRejitId == rejitIdLocal);
1826+
}
1827+
}
1828+
1829+
#endif
1830+
return hr;
1831+
}
17931832
int ISOSDacInterface7.GetReJITInformation(ClrDataAddress methodDesc, int rejitId, /*struct DacpReJitData2*/ void* pRejitData)
17941833
=> _legacyImpl7 is not null ? _legacyImpl7.GetReJITInformation(methodDesc, rejitId, pRejitData) : HResults.E_NOTIMPL;
17951834
int ISOSDacInterface7.GetProfilerModifiedILInformation(ClrDataAddress methodDesc, /*struct DacpProfilerILData*/ void* pILData)

0 commit comments

Comments
 (0)