diff options
author | Brian Sullivan <briansul@microsoft.com> | 2019-05-09 10:02:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-09 10:02:42 -0700 |
commit | dbca82dd58f7192404394ed37d540b07522a5f72 (patch) | |
tree | 3753d03769492cc3c60683522810e531fe5ccfd7 | |
parent | 9773db1e7b1acb3ec75c9cc0e36bd62dcbacd6d5 (diff) | |
parent | b26e28aefdaf82287b6fda0c6a14fc5956077b8c (diff) | |
download | coreclr-dbca82dd58f7192404394ed37d540b07522a5f72.tar.gz coreclr-dbca82dd58f7192404394ed37d540b07522a5f72.tar.bz2 coreclr-dbca82dd58f7192404394ed37d540b07522a5f72.zip |
Merge pull request #24456 from briansull/ibc-work
IBC refactor - Zero Diff, rename types and methods
26 files changed, 262 insertions, 256 deletions
diff --git a/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp b/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp index 251666a823..d8ce7689da 100644 --- a/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp +++ b/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp @@ -930,36 +930,36 @@ void CompileResult::dmpAllocUnwindInfo(DWORD key, const Agnostic_AllocUnwindInfo value.pUnwindBlock_index, value.funcKind); } -void CompileResult::recAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer, HRESULT result) +void CompileResult::recAllocMethodBlockCounts(ULONG count, ICorJitInfo::BlockCounts** pBlockCounts, HRESULT result) { - if (AllocBBProfileBuffer == nullptr) - AllocBBProfileBuffer = new LightWeightMap<DWORD, Agnostic_AllocBBProfileBuffer>(); + if (AllocMethodBlockCounts == nullptr) + AllocMethodBlockCounts = new LightWeightMap<DWORD, Agnostic_AllocMethodBlockCounts>(); - Agnostic_AllocBBProfileBuffer value; + Agnostic_AllocMethodBlockCounts value; value.count = (DWORD)count; value.result = (DWORD)result; - value.profileBuffer_index = - AllocBBProfileBuffer->AddBuffer((unsigned char*)*profileBuffer, count * sizeof(ICorJitInfo::ProfileBuffer)); + value.pBlockCounts_index = + AllocMethodBlockCounts->AddBuffer((unsigned char*)*pBlockCounts, count * sizeof(ICorJitInfo::BlockCounts)); - AllocBBProfileBuffer->Add((DWORD)0, value); + AllocMethodBlockCounts->Add((DWORD)0, value); } -void CompileResult::dmpAllocBBProfileBuffer(DWORD key, const Agnostic_AllocBBProfileBuffer& value) +void CompileResult::dmpAllocMethodBlockCounts(DWORD key, const Agnostic_AllocMethodBlockCounts& value) { - printf("AllocBBProfileBuffer key %u, value cnt-%u ind-%u res-%08X", key, value.count, value.profileBuffer_index, + printf("AllocMethodBlockCounts key %u, value cnt-%u ind-%u res-%08X", key, value.count, value.pBlockCounts_index, value.result); } -HRESULT CompileResult::repAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer) +HRESULT CompileResult::repAllocMethodBlockCounts(ULONG count, ICorJitInfo::BlockCounts** pBlockCounts) { - Agnostic_AllocBBProfileBuffer value; - value = AllocBBProfileBuffer->Get((DWORD)0); + Agnostic_AllocMethodBlockCounts value; + value = AllocMethodBlockCounts->Get((DWORD)0); if (count != value.count) __debugbreak(); HRESULT result = (HRESULT)value.result; - *profileBuffer = (ICorJitInfo::ProfileBuffer*)AllocBBProfileBuffer->GetBuffer(value.profileBuffer_index); - recAddressMap((void*)0x4242, (void*)*profileBuffer, count * (sizeof(ICorJitInfo::ProfileBuffer))); + *pBlockCounts = (ICorJitInfo::BlockCounts*)AllocMethodBlockCounts->GetBuffer(value.pBlockCounts_index); + recAddressMap((void*)0x4242, (void*)*pBlockCounts, count * (sizeof(ICorJitInfo::BlockCounts))); return result; } diff --git a/src/ToolBox/superpmi/superpmi-shared/compileresult.h b/src/ToolBox/superpmi/superpmi-shared/compileresult.h index 1d44a1a2ce..9fa9e45446 100644 --- a/src/ToolBox/superpmi/superpmi-shared/compileresult.h +++ b/src/ToolBox/superpmi/superpmi-shared/compileresult.h @@ -121,10 +121,10 @@ public: DWORD HandlerLength; DWORD ClassToken; // one view of symetric union }; - struct Agnostic_AllocBBProfileBuffer + struct Agnostic_AllocMethodBlockCounts { DWORD count; - DWORD profileBuffer_index; + DWORD pBlockCounts_index; DWORD result; }; struct Agnostic_CORINFO_SIG_INFO2 @@ -279,9 +279,9 @@ public: CorJitFuncKind funcKind); void dmpAllocUnwindInfo(DWORD key, const Agnostic_AllocUnwindInfo& value); - void recAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer, HRESULT result); - void dmpAllocBBProfileBuffer(DWORD key, const Agnostic_AllocBBProfileBuffer& value); - HRESULT repAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer); + void recAllocMethodBlockCounts(ULONG count, ICorJitInfo::BlockCounts** pBlockCounts, HRESULT result); + void dmpAllocMethodBlockCounts(DWORD key, const Agnostic_AllocMethodBlockCounts& value); + HRESULT repAllocMethodBlockCounts(ULONG count, ICorJitInfo::BlockCounts** pBlockCounts); void recRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_HANDLE methodHandle); void dmpRecordCallSite(DWORD key, const Agnostic_RecordCallSite& value); diff --git a/src/ToolBox/superpmi/superpmi-shared/crlwmlist.h b/src/ToolBox/superpmi/superpmi-shared/crlwmlist.h index 84bf13e553..72fa54043a 100644 --- a/src/ToolBox/superpmi/superpmi-shared/crlwmlist.h +++ b/src/ToolBox/superpmi/superpmi-shared/crlwmlist.h @@ -19,7 +19,7 @@ #endif LWM(AddressMap, DWORDLONG, CompileResult::Agnostic_AddressMap) -LWM(AllocBBProfileBuffer, DWORD, CompileResult::Agnostic_AllocBBProfileBuffer) +LWM(AllocMethodBlockCounts, DWORD, CompileResult::Agnostic_AllocMethodBlockCounts) LWM(AllocGCInfo, DWORD, CompileResult::Agnostic_AllocGCInfo) LWM(AllocMem, DWORD, CompileResult::Agnostic_AllocMemDetails) DENSELWM(AllocUnwindInfo, CompileResult::Agnostic_AllocUnwindInfo) diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h index fe4ed6a5ff..61d70a2f37 100644 --- a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h +++ b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h @@ -1017,24 +1017,24 @@ int doAssert(const char* szFile, int iLine, const char* szExpr); void reportFatalError(CorJitResult result); /* -struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA +struct BlockCounts // Also defined here: code:CORBBTPROF_BLOCK_DATA { - ULONG ILOffset; - ULONG ExecutionCount; + UINT32 ILOffset; + UINT32 ExecutionCount; }; */ // allocate a basic block profile buffer where execution counts will be stored // for jitted basic blocks. -HRESULT allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer); +HRESULT allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have + BlockCounts** pBlockCounts); // get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocBBProfileBuffer. -HRESULT getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer, - ULONG* numRuns); +// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. +HRESULT getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, // The number of basic blocks that we have + BlockCounts** pBlockCounts, + UINT32 * pNumRuns); // Associates a native call site, identified by its offset in the native code stream, with // the signature information and method handle the JIT used to lay out the call site. If diff --git a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h index 4fe06d2fd7..36b8469c4d 100644 --- a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h +++ b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h @@ -56,7 +56,7 @@ LWM(GetArgNext, DWORDLONG, DWORDLONG) LWM(GetArgType, GetArgTypeValue, Agnostic_GetArgType_Value) LWM(GetArrayInitializationData, DLD, DWORDLONG) LWM(GetArrayRank, DWORDLONG, DWORD) -LWM(GetBBProfileData, DWORDLONG, Agnostic_GetBBProfileData) +LWM(GetMethodBlockCounts, DWORDLONG, Agnostic_GetMethodBlockCounts) LWM(GetBoundaries, DWORDLONG, Agnostic_GetBoundaries) LWM(GetBoxHelper, DWORDLONG, DWORD) LWM(GetBuiltinClass, DWORD, DWORDLONG) diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index ebe7808ee5..96e95d1ed6 100644 --- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -5237,49 +5237,49 @@ DWORD MethodContext::repGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, v return (DWORD)value.B; } -void MethodContext::recGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, - ICorJitInfo::ProfileBuffer** profileBuffer, - ULONG* numRuns, - HRESULT result) +void MethodContext::recGetMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, + ICorJitInfo::BlockCounts** pBlockCounts, + UINT32 * pNumRuns, + HRESULT result) { - if (GetBBProfileData == nullptr) - GetBBProfileData = new LightWeightMap<DWORDLONG, Agnostic_GetBBProfileData>(); + if (GetMethodBlockCounts == nullptr) + GetMethodBlockCounts = new LightWeightMap<DWORDLONG, Agnostic_GetMethodBlockCounts>(); - Agnostic_GetBBProfileData value; + Agnostic_GetMethodBlockCounts value; - value.count = (DWORD)*count; - value.profileBuffer_index = - GetBBProfileData->AddBuffer((unsigned char*)*profileBuffer, sizeof(ICorJitInfo::ProfileBuffer) * (*count)); - value.numRuns = (DWORD)*numRuns; + value.count = (DWORD)*pCount; + value.pBlockCounts_index = + GetMethodBlockCounts->AddBuffer((unsigned char*)*pBlockCounts, sizeof(ICorJitInfo::BlockCounts) * (*pCount)); + value.numRuns = (DWORD)*pNumRuns; value.result = (DWORD)result; - GetBBProfileData->Add((DWORDLONG)ftnHnd, value); + GetMethodBlockCounts->Add((DWORDLONG)ftnHnd, value); } -void MethodContext::dmpGetBBProfileData(DWORDLONG key, const Agnostic_GetBBProfileData& value) +void MethodContext::dmpGetMethodBlockCounts(DWORDLONG key, const Agnostic_GetMethodBlockCounts& value) { - printf("GetBBProfileData key ftn-%016llX, value cnt-%u profileBuf-", key, value.count); - ICorJitInfo::ProfileBuffer* pBuf = - (ICorJitInfo::ProfileBuffer*)GetBBProfileData->GetBuffer(value.profileBuffer_index); + printf("GetMethodBlockCounts key ftn-%016llX, value cnt-%u profileBuf-", key, value.count); + ICorJitInfo::BlockCounts* pBuf = + (ICorJitInfo::BlockCounts*)GetMethodBlockCounts->GetBuffer(value.pBlockCounts_index); for (DWORD i = 0; i < value.count; i++, pBuf++) { printf("{il-%u,cnt-%u}", pBuf->ILOffset, pBuf->ExecutionCount); } - GetBBProfileData->Unlock(); + GetMethodBlockCounts->Unlock(); printf(" numRuns-%u result-%u", value.numRuns, value.result); } -HRESULT MethodContext::repGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, - ICorJitInfo::ProfileBuffer** profileBuffer, - ULONG* numRuns) +HRESULT MethodContext::repGetMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, + ICorJitInfo::BlockCounts** pBlockCounts, + UINT32 * pNumRuns) { - Agnostic_GetBBProfileData tempValue; + Agnostic_GetMethodBlockCounts tempValue; - tempValue = GetBBProfileData->Get((DWORDLONG)ftnHnd); + tempValue = GetMethodBlockCounts->Get((DWORDLONG)ftnHnd); - *count = (ULONG)tempValue.count; - *profileBuffer = (ICorJitInfo::ProfileBuffer*)GetBBProfileData->GetBuffer(tempValue.profileBuffer_index); - *numRuns = (ULONG)tempValue.numRuns; + *pCount = (UINT32)tempValue.count; + *pBlockCounts = (ICorJitInfo::BlockCounts*)GetMethodBlockCounts->GetBuffer(tempValue.pBlockCounts_index); + *pNumRuns = (UINT32)tempValue.numRuns; HRESULT result = (HRESULT)tempValue.result; return result; } diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h index 8de6a070f0..c28a3f7233 100644 --- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -425,10 +425,10 @@ public: DWORDLONG method; DWORDLONG delegateCls; }; - struct Agnostic_GetBBProfileData + struct Agnostic_GetMethodBlockCounts { DWORD count; - DWORD profileBuffer_index; + DWORD pBlockCounts_index; DWORD numRuns; DWORD result; }; @@ -1189,16 +1189,16 @@ public: void dmpGetFieldThreadLocalStoreID(DWORDLONG key, DLD value); DWORD repGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection); - void recGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, - ICorJitInfo::ProfileBuffer** profileBuffer, - ULONG* numRuns, - HRESULT result); - void dmpGetBBProfileData(DWORDLONG key, const Agnostic_GetBBProfileData& value); - HRESULT repGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, - ICorJitInfo::ProfileBuffer** profileBuffer, - ULONG* numRuns); + void recGetMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, + ICorJitInfo::BlockCounts** pBlockCounts, + UINT32 * pNumRuns, + HRESULT result); + void dmpGetMethodBlockCounts(DWORDLONG key, const Agnostic_GetMethodBlockCounts& value); + HRESULT repGetMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, + ICorJitInfo::BlockCounts** pBlockCounts, + UINT32 * pNumRuns); void recMergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2, CORINFO_CLASS_HANDLE result); void dmpMergeClasses(DLDL key, DWORDLONG value); @@ -1405,7 +1405,7 @@ enum mcPackets Packet_GetArgType = 140, // retired as 30 on 2013/07/03 Packet_GetArrayInitializationData = 31, Packet_GetArrayRank = 32, - Packet_GetBBProfileData = 33, + Packet_GetMethodBlockCounts = 33, Packet_GetBoundaries = 34, Packet_GetBoxHelper = 35, Packet_GetBuiltinClass = 36, @@ -1508,7 +1508,7 @@ enum mcPackets Packet_ShouldEnforceCallvirtRestriction = 112, PacketCR_AddressMap = 113, - PacketCR_AllocBBProfileBuffer = 131, + PacketCR_AllocMethodBlockCounts = 131, PacketCR_AllocGCInfo = 114, PacketCR_AllocMem = 115, PacketCR_AllocUnwindInfo = 132, diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp index 79071488a7..0d41b108bc 100644 --- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp @@ -2117,25 +2117,25 @@ void interceptor_ICJI::reportFatalError(CorJitResult result) // allocate a basic block profile buffer where execution counts will be stored // for jitted basic blocks. -HRESULT interceptor_ICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer) +HRESULT interceptor_ICJI::allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have + BlockCounts** pBlockCounts) { - mc->cr->AddCall("allocBBProfileBuffer"); - HRESULT result = original_ICorJitInfo->allocBBProfileBuffer(count, profileBuffer); - mc->cr->recAllocBBProfileBuffer(count, profileBuffer, result); + mc->cr->AddCall("allocMethodBlockCounts"); + HRESULT result = original_ICorJitInfo->allocMethodBlockCounts(count, pBlockCounts); + mc->cr->recAllocMethodBlockCounts(count, pBlockCounts, result); return result; } // get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocBBProfileBuffer. -HRESULT interceptor_ICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer, - ULONG* numRuns) -{ - mc->cr->AddCall("getBBProfileData"); - HRESULT temp = original_ICorJitInfo->getBBProfileData(ftnHnd, count, profileBuffer, numRuns); - mc->recGetBBProfileData(ftnHnd, count, profileBuffer, numRuns, temp); +// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. +HRESULT interceptor_ICJI::getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, // The number of basic blocks that we have + BlockCounts** pBlockCounts, + UINT32 * pNumRuns) +{ + mc->cr->AddCall("getMethodBlockCounts"); + HRESULT temp = original_ICorJitInfo->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns); + mc->recGetMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns, temp); return temp; } diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index 044f1f2c4a..587aeec641 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -1671,31 +1671,31 @@ void interceptor_ICJI::reportFatalError(CorJitResult result) } /* -struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA +struct BlockCounts // Also defined here: code:CORBBTPROF_BLOCK_DATA { - ULONG ILOffset; - ULONG ExecutionCount; + UINT32 ILOffset; + UINT32 ExecutionCount; }; */ // allocate a basic block profile buffer where execution counts will be stored // for jitted basic blocks. -HRESULT interceptor_ICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer) +HRESULT interceptor_ICJI::allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have + BlockCounts** pBlockCounts) { - mcs->AddCall("allocBBProfileBuffer"); - return original_ICorJitInfo->allocBBProfileBuffer(count, profileBuffer); + mcs->AddCall("allocMethodBlockCounts"); + return original_ICorJitInfo->allocMethodBlockCounts(count, pBlockCounts); } // get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocBBProfileBuffer. -HRESULT interceptor_ICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer, - ULONG* numRuns) -{ - mcs->AddCall("getBBProfileData"); - return original_ICorJitInfo->getBBProfileData(ftnHnd, count, profileBuffer, numRuns); +// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. +HRESULT interceptor_ICJI::getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, // The number of basic blocks that we have + BlockCounts** pBlockCounts, + UINT32 * pNumRuns) +{ + mcs->AddCall("getMethodBlockCounts"); + return original_ICorJitInfo->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns); } // Associates a native call site, identified by its offset in the native code stream, with diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp index 49dd2423e1..e33d9e6e29 100644 --- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp @@ -1497,20 +1497,20 @@ void interceptor_ICJI::reportFatalError(CorJitResult result) // allocate a basic block profile buffer where execution counts will be stored // for jitted basic blocks. -HRESULT interceptor_ICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer) +HRESULT interceptor_ICJI::allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have + BlockCounts** pBlockCounts) { - return original_ICorJitInfo->allocBBProfileBuffer(count, profileBuffer); + return original_ICorJitInfo->allocMethodBlockCounts(count, pBlockCounts); } // get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocBBProfileBuffer. -HRESULT interceptor_ICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer, - ULONG* numRuns) +// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. +HRESULT interceptor_ICJI::getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, // The number of basic blocks that we have + BlockCounts** pBlockCounts, + UINT32 * pNumRuns) { - return original_ICorJitInfo->getBBProfileData(ftnHnd, count, profileBuffer, numRuns); + return original_ICorJitInfo->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns); } // Associates a native call site, identified by its offset in the native code stream, with diff --git a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp index 377ad1d054..2ced2d812c 100644 --- a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp @@ -1810,22 +1810,22 @@ void MyICJI::reportFatalError(CorJitResult result) // allocate a basic block profile buffer where execution counts will be stored // for jitted basic blocks. -HRESULT MyICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer) +HRESULT MyICJI::allocMethodBlockCounts(UINT32 count, // The number of basic blocks that we have + BlockCounts** pBlockCounts) { - jitInstance->mc->cr->AddCall("allocBBProfileBuffer"); - return jitInstance->mc->cr->repAllocBBProfileBuffer(count, profileBuffer); + jitInstance->mc->cr->AddCall("allocMethodBlockCounts"); + return jitInstance->mc->cr->repAllocMethodBlockCounts(count, pBlockCounts); } // get profile information to be used for optimizing the current method. The format -// of the buffer is the same as the format the JIT passes to allocBBProfileBuffer. -HRESULT MyICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, - ULONG* count, // The number of basic blocks that we have - ProfileBuffer** profileBuffer, - ULONG* numRuns) -{ - jitInstance->mc->cr->AddCall("getBBProfileData"); - return jitInstance->mc->repGetBBProfileData(ftnHnd, count, profileBuffer, numRuns); +// of the buffer is the same as the format the JIT passes to allocMethodBlockCounts. +HRESULT MyICJI::getMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, // The number of basic blocks that we have + BlockCounts** pBlockCounts, + UINT32 * pNumRuns) +{ + jitInstance->mc->cr->AddCall("getMethodBlockCounts"); + return jitInstance->mc->repGetMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns); } // Associates a native call site, identified by its offset in the native code stream, with diff --git a/src/inc/corbbtprof.h b/src/inc/corbbtprof.h index 5aa7782544..f7258c1e5b 100644 --- a/src/inc/corbbtprof.h +++ b/src/inc/corbbtprof.h @@ -402,10 +402,10 @@ struct CORBBTPROF_METHOD_BLOCK_COUNTS_SECTION_HEADER DWORD NumMethods; }; -struct CORBBTPROF_BLOCK_DATA // Also defined here code:ICorJitInfo.ProfileBuffer +struct CORBBTPROF_BLOCK_DATA // This struct is also defined by: ICorJitInfo.BlockCounts { - DWORD ILOffset; - DWORD ExecutionCount; + UINT32 ILOffset; + UINT32 ExecutionCount; }; struct CORBBTPROF_METHOD_DETAIL_HEADER diff --git a/src/inc/corjit.h b/src/inc/corjit.h index 7d818d4d42..20ff2b3055 100644 --- a/src/inc/corjit.h +++ b/src/inc/corjit.h @@ -389,26 +389,26 @@ public: virtual void reportFatalError(CorJitResult result) = 0; - struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA + struct BlockCounts // Also defined by: CORBBTPROF_BLOCK_DATA { - ULONG ILOffset; - ULONG ExecutionCount; + UINT32 ILOffset; + UINT32 ExecutionCount; }; // allocate a basic block profile buffer where execution counts will be stored // for jitted basic blocks. - virtual HRESULT allocBBProfileBuffer ( - ULONG count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer + virtual HRESULT allocMethodBlockCounts ( + UINT32 count, // The number of basic blocks that we have + BlockCounts ** pBlockCounts // pointer to array of <ILOffset, ExecutionCount> tuples ) = 0; // get profile information to be used for optimizing the current method. The format // of the buffer is the same as the format the JIT passes to allocBBProfileBuffer. - virtual HRESULT getBBProfileData( + virtual HRESULT getMethodBlockCounts( CORINFO_METHOD_HANDLE ftnHnd, - ULONG * count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer, - ULONG * numRuns + UINT32 * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples + BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples + UINT32 * pNumRuns // pointer to the total number of profile scenarios run ) = 0; // Associates a native call site, identified by its offset in the native code stream, with diff --git a/src/jit/ICorJitInfo_API_names.h b/src/jit/ICorJitInfo_API_names.h index fe7253146d..3a287f8891 100644 --- a/src/jit/ICorJitInfo_API_names.h +++ b/src/jit/ICorJitInfo_API_names.h @@ -165,8 +165,8 @@ DEF_CLR_API(setEHinfo) DEF_CLR_API(logMsg) DEF_CLR_API(doAssert) DEF_CLR_API(reportFatalError) -DEF_CLR_API(allocBBProfileBuffer) -DEF_CLR_API(getBBProfileData) +DEF_CLR_API(allocMethodBlockCounts) +DEF_CLR_API(getMethodBlockCounts) DEF_CLR_API(recordCallSite) DEF_CLR_API(recordRelocation) DEF_CLR_API(getRelocTypeHint) diff --git a/src/jit/ICorJitInfo_API_wrapper.hpp b/src/jit/ICorJitInfo_API_wrapper.hpp index e34ea9539c..758c189110 100644 --- a/src/jit/ICorJitInfo_API_wrapper.hpp +++ b/src/jit/ICorJitInfo_API_wrapper.hpp @@ -1590,25 +1590,25 @@ void WrapICorJitInfo::reportFatalError(CorJitResult result) API_LEAVE(reportFatalError); } -HRESULT WrapICorJitInfo::allocBBProfileBuffer( - ULONG count, - ProfileBuffer **profileBuffer) +HRESULT WrapICorJitInfo::allocMethodBlockCounts( + UINT32 count, + BlockCounts **pBlockCounts) { - API_ENTER(allocBBProfileBuffer); - HRESULT result = wrapHnd->allocBBProfileBuffer(count, profileBuffer); - API_LEAVE(allocBBProfileBuffer); + API_ENTER(allocMethodBlockCounts); + HRESULT result = wrapHnd->allocMethodBlockCounts(count, pBlockCounts); + API_LEAVE(allocMethodBlockCounts); return result; } -HRESULT WrapICorJitInfo::getBBProfileData( +HRESULT WrapICorJitInfo::getMethodBlockCounts( CORINFO_METHOD_HANDLE ftnHnd, - ULONG *count, - ProfileBuffer **profileBuffer, - ULONG *numRuns) + UINT32 *pCount, + BlockCounts **pBlockCounts, + UINT32 *pNumRuns) { - API_ENTER(getBBProfileData); - HRESULT temp = wrapHnd->getBBProfileData(ftnHnd, count, profileBuffer, numRuns); - API_LEAVE(getBBProfileData); + API_ENTER(getMethodBlockCounts); + HRESULT temp = wrapHnd->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns); + API_LEAVE(getMethodBlockCounts); return temp; } diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp index f4f963b1a5..8cb16d79e3 100644 --- a/src/jit/compiler.cpp +++ b/src/jit/compiler.cpp @@ -3463,41 +3463,41 @@ void Compiler::compInitOptions(JitFlags* jitFlags) #endif } - fgProfileBuffer = nullptr; + fgBlockCounts = nullptr; fgProfileData_ILSizeMismatch = false; fgNumProfileRuns = 0; if (jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT)) { assert(!compIsForInlining()); HRESULT hr; - hr = info.compCompHnd->getBBProfileData(info.compMethodHnd, &fgProfileBufferCount, &fgProfileBuffer, - &fgNumProfileRuns); + hr = info.compCompHnd->getMethodBlockCounts(info.compMethodHnd, &fgBlockCountsCount, &fgBlockCounts, + &fgNumProfileRuns); - // a failed result that also has a non-NULL fgProfileBuffer + // a failed result that also has a non-NULL fgBlockCounts // indicates that the ILSize for the method no longer matches // the ILSize for the method when profile data was collected. // // We will discard the IBC data in this case // - if (FAILED(hr) && (fgProfileBuffer != nullptr)) + if (FAILED(hr) && (fgBlockCounts != nullptr)) { fgProfileData_ILSizeMismatch = true; - fgProfileBuffer = nullptr; + fgBlockCounts = nullptr; } #ifdef DEBUG - // A successful result implies a non-NULL fgProfileBuffer + // A successful result implies a non-NULL fgBlockCounts // if (SUCCEEDED(hr)) { - assert(fgProfileBuffer != nullptr); + assert(fgBlockCounts != nullptr); } - // A failed result implies a NULL fgProfileBuffer + // A failed result implies a NULL fgBlockCounts // see implementation of Compiler::fgHaveProfileData() // if (FAILED(hr)) { - assert(fgProfileBuffer == nullptr); + assert(fgBlockCounts == nullptr); } #endif } @@ -5471,8 +5471,8 @@ void Compiler::compCompileFinish() unsigned profCallCount = 0; if (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT) && fgHaveProfileData()) { - assert(fgProfileBuffer[0].ILOffset == 0); - profCallCount = fgProfileBuffer[0].ExecutionCount; + assert(fgBlockCounts[0].ILOffset == 0); + profCallCount = fgBlockCounts[0].ExecutionCount; } static bool headerPrinted = false; @@ -5948,7 +5948,12 @@ int Compiler::compCompileHelper(CORINFO_MODULE_HANDLE classPtr, goto _Next; } +#ifdef FEATURE_CORECLR if (fgHasBackwardJump && (info.compFlags & CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS) != 0 && fgCanSwitchToTier1()) +#else // !FEATURE_CORECLR + // We may want to use JitConfig value here to support DISABLE_TIER0_FOR_LOOPS + if (fgHasBackwardJump && fgCanSwitchToTier1()) +#endif { // Method likely has a loop, switch to the OptimizedTier to avoid spending too much time running slower code fgSwitchToTier1(); diff --git a/src/jit/compiler.h b/src/jit/compiler.h index 9afd97a31e..1db70d1612 100644 --- a/src/jit/compiler.h +++ b/src/jit/compiler.h @@ -5130,10 +5130,10 @@ protected: void fgAdjustForAddressExposedOrWrittenThis(); - bool fgProfileData_ILSizeMismatch; - ICorJitInfo::ProfileBuffer* fgProfileBuffer; - ULONG fgProfileBufferCount; - ULONG fgNumProfileRuns; + bool fgProfileData_ILSizeMismatch; + ICorJitInfo::BlockCounts* fgBlockCounts; + UINT32 fgBlockCountsCount; + UINT32 fgNumProfileRuns; unsigned fgStressBBProf() { diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index c9348d88af..d8b12188ec 100644 --- a/src/jit/flowgraph.cpp +++ b/src/jit/flowgraph.cpp @@ -183,7 +183,7 @@ bool Compiler::fgHaveProfileData() return false; } - return (fgProfileBuffer != nullptr); + return (fgBlockCounts != nullptr); } bool Compiler::fgGetProfileWeightForBasicBlock(IL_OFFSET offset, unsigned* weightWB) @@ -232,11 +232,11 @@ bool Compiler::fgGetProfileWeightForBasicBlock(IL_OFFSET offset, unsigned* weigh } noway_assert(!compIsForInlining()); - for (unsigned i = 0; i < fgProfileBufferCount; i++) + for (UINT32 i = 0; i < fgBlockCountsCount; i++) { - if (fgProfileBuffer[i].ILOffset == offset) + if (fgBlockCounts[i].ILOffset == offset) { - weight = fgProfileBuffer[i].ExecutionCount; + weight = fgBlockCounts[i].ExecutionCount; *weightWB = weight; return true; @@ -266,9 +266,9 @@ void Compiler::fgInstrumentMethod() // Allocate the profile buffer - ICorJitInfo::ProfileBuffer* bbProfileBufferStart; + ICorJitInfo::BlockCounts* profileBlockCountsStart; - HRESULT res = info.compCompHnd->allocBBProfileBuffer(countOfBlocks, &bbProfileBufferStart); + HRESULT res = info.compCompHnd->allocMethodBlockCounts(countOfBlocks, &profileBlockCountsStart); GenTreeStmt* stmt; @@ -286,7 +286,7 @@ void Compiler::fgInstrumentMethod() } else { - noway_assert(!"Error: failed to allocate bbProfileBuffer"); + noway_assert(!"Error: failed to allocate profileBlockCounts"); return; } } @@ -296,10 +296,10 @@ void Compiler::fgInstrumentMethod() // 1. Assign the blocks bbCodeOffs to the ILOffset field of this blocks profile data. // 2. Add an operation that increments the ExecutionCount field at the beginning of the block. - // Each (non-Internal) block has it own ProfileBuffer tuple [ILOffset, ExecutionCount] + // Each (non-Internal) block has it own BlockCounts tuple [ILOffset, ExecutionCount] // To start we initialize our current one with the first one that we allocated // - ICorJitInfo::ProfileBuffer* bbCurrentBlockProfileBuffer = bbProfileBufferStart; + ICorJitInfo::BlockCounts* currentBlockCounts = profileBlockCountsStart; for (block = fgFirstBB; (block != nullptr); block = block->bbNext) { @@ -309,10 +309,10 @@ void Compiler::fgInstrumentMethod() } // Assign the current block's IL offset into the profile data - bbCurrentBlockProfileBuffer->ILOffset = block->bbCodeOffs; - assert(bbCurrentBlockProfileBuffer->ExecutionCount == 0); // This value should already be zero-ed out + currentBlockCounts->ILOffset = block->bbCodeOffs; + assert(currentBlockCounts->ExecutionCount == 0); // This value should already be zero-ed out - size_t addrOfCurrentExecutionCount = (size_t)&bbCurrentBlockProfileBuffer->ExecutionCount; + size_t addrOfCurrentExecutionCount = (size_t)¤tBlockCounts->ExecutionCount; // Read Basic-Block count value GenTree* valueNode = @@ -327,13 +327,13 @@ void Compiler::fgInstrumentMethod() fgInsertStmtAtBeg(block, asgNode); - // Advance to the next ProfileBuffer tuple [ILOffset, ExecutionCount] - bbCurrentBlockProfileBuffer++; + // Advance to the next BlockCounts tuple [ILOffset, ExecutionCount] + currentBlockCounts++; // One less block countOfBlocks--; } - // Check that we allocated and initialized the same number of ProfileBuffer tuples + // Check that we allocated and initialized the same number of BlockCounts tuples noway_assert(countOfBlocks == 0); // Add the method entry callback node @@ -365,7 +365,7 @@ void Compiler::fgInstrumentMethod() GenTree* call = gtNewHelperCallNode(CORINFO_HELP_BBT_FCN_ENTER, TYP_VOID, args); // Get the address of the first blocks ExecutionCount - size_t addrOfFirstExecutionCount = (size_t)&bbProfileBufferStart->ExecutionCount; + size_t addrOfFirstExecutionCount = (size_t)&profileBlockCountsStart->ExecutionCount; // Read Basic-Block count value GenTree* valueNode = gtNewIndOfIconHandleNode(TYP_INT, addrOfFirstExecutionCount, GTF_ICON_BBC_PTR, false); diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 539848b817..78b9e68413 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -10668,9 +10668,9 @@ BOOL Module::FixupNativeEntry(CORCOMPILE_IMPORT_SECTION* pSection, SIZE_T fixupI // Profile data management // -ICorJitInfo::ProfileBuffer * Module::AllocateProfileBuffer(mdToken _token, DWORD _count, DWORD _ILSize) +ICorJitInfo::BlockCounts * Module::AllocateMethodBlockCounts(mdToken _token, DWORD _count, DWORD _ILSize) { - CONTRACT (ICorJitInfo::ProfileBuffer*) + CONTRACT (ICorJitInfo::BlockCounts*) { INSTANCE_CHECK; THROWS; @@ -10707,7 +10707,7 @@ ICorJitInfo::ProfileBuffer * Module::AllocateProfileBuffer(mdToken _token, DWORD methodProfileList->next = m_methodProfileList; m_methodProfileList = methodProfileList; - RETURN ((ICorJitInfo::ProfileBuffer *) &methodProfileData->method.block[0]); + RETURN ((ICorJitInfo::BlockCounts *) &methodProfileData->method.block[0]); } HANDLE Module::OpenMethodProfileDataLogFile(GUID mvid) @@ -11923,7 +11923,7 @@ static void ProfileDataAllocateMethodBlockCounts(ProfileEmitter * pEmitter, CORC } // Reset all of the basic block counts to zero - for (ULONG i=0; (i < pInfo->method.cBlock); i++ ) + for (UINT32 i=0; (i < pInfo->method.cBlock); i++ ) { // // If methodWasExecuted is false then every block's ExecutionCount should also be zero diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h index 407d96933c..6b2496b903 100644 --- a/src/vm/ceeload.h +++ b/src/vm/ceeload.h @@ -2849,7 +2849,7 @@ public: } #endif // FEATURE_PREJIT - ICorJitInfo::ProfileBuffer * AllocateProfileBuffer(mdToken _token, DWORD _size, DWORD _ILSize); + ICorJitInfo::BlockCounts * AllocateMethodBlockCounts(mdToken _token, DWORD _size, DWORD _ILSize); HANDLE OpenMethodProfileDataLogFile(GUID mvid); static void ProfileDataAllocateTokenLists(ProfileEmitter * pEmitter, TokenProfileData* pTokenProfileData); HRESULT WriteMethodProfileDataLogFile(bool cleanup); diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 8059e0c212..f8896aedd6 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -11920,9 +11920,9 @@ void* CEEJitInfo::getMethodSync(CORINFO_METHOD_HANDLE ftnHnd, } /*********************************************************************/ -HRESULT CEEJitInfo::allocBBProfileBuffer ( - ULONG count, - ICorJitInfo::ProfileBuffer ** profileBuffer +HRESULT CEEJitInfo::allocMethodBlockCounts ( + UINT32 count, // count of <ILOffset, ExecutionCount> tuples + ICorJitInfo::BlockCounts ** pBlockCounts // pointer to array of <ILOffset, ExecutionCount> tuples ) { CONTRACTL { @@ -11954,10 +11954,10 @@ HRESULT CEEJitInfo::allocBBProfileBuffer ( codeSize = m_ILHeader->GetCodeSize(); } - *profileBuffer = m_pMethodBeingCompiled->GetLoaderModule()->AllocateProfileBuffer(m_pMethodBeingCompiled->GetMemberDef(), count, codeSize); - hr = (*profileBuffer ? S_OK : E_OUTOFMEMORY); + *pBlockCounts = m_pMethodBeingCompiled->GetLoaderModule()->AllocateMethodBlockCounts(m_pMethodBeingCompiled->GetMemberDef(), count, codeSize); + hr = (*pBlockCounts != nullptr) ? S_OK : E_OUTOFMEMORY; #else // FEATURE_PREJIT - _ASSERTE(!"allocBBProfileBuffer not implemented on CEEJitInfo!"); + _ASSERTE(!"allocMethodBlockCounts not implemented on CEEJitInfo!"); hr = E_NOTIMPL; #endif // !FEATURE_PREJIT @@ -11968,15 +11968,15 @@ HRESULT CEEJitInfo::allocBBProfileBuffer ( // Consider implementing getBBProfileData on CEEJitInfo. This will allow us // to use profile info in codegen for non zapped images. -HRESULT CEEJitInfo::getBBProfileData ( +HRESULT CEEJitInfo::getMethodBlockCounts ( CORINFO_METHOD_HANDLE ftnHnd, - ULONG * size, - ICorJitInfo::ProfileBuffer ** profileBuffer, - ULONG * numRuns + UINT32 * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples + ICorJitInfo::BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples + UINT32 * pNumRuns ) { LIMITED_METHOD_CONTRACT; - _ASSERTE(!"getBBProfileData not implemented on CEEJitInfo!"); + _ASSERTE(!"getMethodBlockCounts not implemented on CEEJitInfo!"); return E_NOTIMPL; } @@ -13994,20 +13994,20 @@ void* CEEInfo::getMethodSync(CORINFO_METHOD_HANDLE ftnHnd, UNREACHABLE(); // only called on derived class. } -HRESULT CEEInfo::allocBBProfileBuffer ( - ULONG count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer +HRESULT CEEInfo::allocMethodBlockCounts ( + UINT32 count, // the count of <ILOffset, ExecutionCount> tuples + BlockCounts ** pBlockCounts // pointer to array of <ILOffset, ExecutionCount> tuples ) { LIMITED_METHOD_CONTRACT; UNREACHABLE_RET(); // only called on derived class. } -HRESULT CEEInfo::getBBProfileData( +HRESULT CEEInfo::getMethodBlockCounts( CORINFO_METHOD_HANDLE ftnHnd, - ULONG * count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer, - ULONG * numRuns + UINT32 * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples + BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples + UINT32 * pNumRuns ) { LIMITED_METHOD_CONTRACT; diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h index e97eb330ca..11b0b7fc3d 100644 --- a/src/vm/jitinterface.h +++ b/src/vm/jitinterface.h @@ -1088,16 +1088,16 @@ public: void logSQMLongJitEvent(unsigned mcycles, unsigned msec, unsigned ilSize, unsigned numBasicBlocks, bool minOpts, CORINFO_METHOD_HANDLE methodHnd); - HRESULT allocBBProfileBuffer ( - ULONG count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer + HRESULT allocMethodBlockCounts ( + UINT32 count, // the count of <ILOffset, ExecutionCount> tuples + BlockCounts ** pBlockCounts // pointer to array of <ILOffset, ExecutionCount> tuples ); - HRESULT getBBProfileData( + HRESULT getMethodBlockCounts( CORINFO_METHOD_HANDLE ftnHnd, - ULONG * count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer, - ULONG * numRuns + UINT32 * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples + BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples + UINT32 * pNumRuns ); void recordCallSite( @@ -1295,16 +1295,16 @@ public: ); - HRESULT allocBBProfileBuffer ( - ULONG count, // The number of basic blocks that we have - ICorJitInfo::ProfileBuffer ** profileBuffer + HRESULT allocMethodBlockCounts ( + UINT32 count, // the count of <ILOffset, ExecutionCount> tuples + ICorJitInfo::BlockCounts ** pBlockCounts // pointer to array of <ILOffset, ExecutionCount> tuples ); - HRESULT getBBProfileData ( + HRESULT getMethodBlockCounts( CORINFO_METHOD_HANDLE ftnHnd, - ULONG * count, // The number of basic blocks that we have - ICorJitInfo::ProfileBuffer ** profileBuffer, - ULONG * numRuns + UINT32 * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples + BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples + UINT32 * pNumRuns ); void recordCallSite( diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index 50df05ff6f..196337d86e 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -3276,7 +3276,7 @@ HRESULT ZapImage::RehydrateProfileData() return hr; } -HRESULT ZapImage::hashBBProfileData () +HRESULT ZapImage::hashMethodBlockCounts() { ProfileDataSection * DataSection_MethodBlockCounts = & m_profileDataSections[MethodBlockCounts]; @@ -3290,7 +3290,7 @@ HRESULT ZapImage::hashBBProfileData () CORBBTPROF_METHOD_BLOCK_COUNTS_SECTION_HEADER *mbcHeader; READ(mbcHeader,CORBBTPROF_METHOD_BLOCK_COUNTS_SECTION_HEADER); - for (ULONG i = 0; i < mbcHeader->NumMethods; i++) + for (DWORD i = 0; i < mbcHeader->NumMethods; i++) { ProfileDataHashEntry newEntry; newEntry.pos = profileReader.GetCurrentPos(); @@ -3357,7 +3357,7 @@ void ZapImage::LoadProfileData() hr = parseProfileData(); if (hr == S_OK) { - hr = hashBBProfileData(); + hr = hashMethodBlockCounts(); } } } diff --git a/src/zap/zapimage.h b/src/zap/zapimage.h index d5317a31e3..4e9d233e75 100644 --- a/src/zap/zapimage.h +++ b/src/zap/zapimage.h @@ -840,14 +840,15 @@ public: } HRESULT LocateProfileData(); - HRESULT parseProfileData (); + HRESULT parseProfileData(); HRESULT convertProfileDataFromV1(); + HRESULT hashMethodBlockCounts(); + void hashBBUpdateFlagsAndCompileResult(mdToken token, unsigned methodProfilingDataFlags, CompileStatus compileResult); + void RehydrateBasicBlockSection(); void RehydrateTokenSection(int sectionFormat, unsigned int flagTable[255]); void RehydrateBlobStream(); HRESULT RehydrateProfileData(); - HRESULT hashBBProfileData (); - void hashBBUpdateFlagsAndCompileResult(mdToken token, unsigned methodProfilingDataFlags, CompileStatus compileResult); void LoadProfileData(); CorProfileData * NewProfileData(); diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp index 21ce5f558d..6d66a56876 100644 --- a/src/zap/zapinfo.cpp +++ b/src/zap/zapinfo.cpp @@ -876,23 +876,23 @@ bool ZapInfo::runWithErrorTrap(void (*function)(void*), void* param) return m_pEEJitInfo->runWithErrorTrap(function, param); } -HRESULT ZapInfo::allocBBProfileBuffer ( - ULONG cBlock, - ICorJitInfo::ProfileBuffer ** ppBlock +HRESULT ZapInfo::allocMethodBlockCounts ( + UINT32 count, // the count of <ILOffset, ExecutionCount> tuples + ICorJitInfo::BlockCounts ** pBlockCounts // pointer to array of <ILOffset, ExecutionCount> tuples ) { HRESULT hr; if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)) { - *ppBlock = NULL; + *pBlockCounts = nullptr; return E_NOTIMPL; } // @TODO: support generic methods from other assemblies if (m_currentMethodModule != m_pImage->m_hModule) { - *ppBlock = NULL; + *pBlockCounts = nullptr; return E_NOTIMPL; } @@ -921,39 +921,39 @@ HRESULT ZapInfo::allocBBProfileBuffer ( // of the latest copy in this case. // _ASSERTE(m_pProfileData == NULL); - DWORD totalSize = (DWORD) (cBlock * sizeof(ICorJitInfo::ProfileBuffer)) + sizeof(CORBBTPROF_METHOD_HEADER); + DWORD totalSize = (DWORD) (count * sizeof(ICorJitInfo::BlockCounts)) + sizeof(CORBBTPROF_METHOD_HEADER); m_pProfileData = ZapBlobWithRelocs::NewAlignedBlob(m_pImage, NULL, totalSize, sizeof(DWORD)); CORBBTPROF_METHOD_HEADER * profileData = (CORBBTPROF_METHOD_HEADER *) m_pProfileData->GetData(); profileData->size = totalSize; profileData->cDetail = 0; profileData->method.token = md; profileData->method.ILSize = m_currentMethodInfo.ILCodeSize; - profileData->method.cBlock = cBlock; + profileData->method.cBlock = count; - *ppBlock = (ICorJitInfo::ProfileBuffer *)(&profileData->method.block[0]); + *pBlockCounts = (ICorJitInfo::BlockCounts *)(&profileData->method.block[0]); return S_OK; } -HRESULT ZapInfo::getBBProfileData ( - CORINFO_METHOD_HANDLE ftnHnd, - ULONG * pCount, - ICorJitInfo::ProfileBuffer ** ppBlock, - ULONG * numRuns +HRESULT ZapInfo::getMethodBlockCounts ( + CORINFO_METHOD_HANDLE ftnHnd, + UINT32 * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples + BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples + UINT32 * pNumRuns ) { - _ASSERTE(ppBlock); - _ASSERTE(pCount); + _ASSERTE(pBlockCounts != nullptr); + _ASSERTE(pCount != nullptr); _ASSERTE(ftnHnd == m_currentMethodHandle); HRESULT hr; // Initialize outputs in case we return E_FAIL - *ppBlock = NULL; + *pBlockCounts = nullptr; *pCount = 0; - if (numRuns) + if (pNumRuns != nullptr) { - *numRuns = 0; + *pNumRuns = 0; } // For generic instantiations whose IL is in another module, @@ -992,9 +992,9 @@ HRESULT ZapInfo::getBBProfileData ( return E_FAIL; } - if (numRuns) + if (pNumRuns != nullptr) { - *numRuns = m_pImage->m_profileDataNumRuns; + *pNumRuns = m_pImage->m_profileDataNumRuns; } const ZapImage::ProfileDataHashEntry * foundEntry = m_pImage->profileDataHashTable.LookupPtr(md); @@ -1029,7 +1029,7 @@ HRESULT ZapInfo::getBBProfileData ( _ASSERTE(profileData->method.token == foundEntry->md); // We should be looking at the right method _ASSERTE(profileData->size == foundEntry->size); // and the cached size must match - *ppBlock = (ICorJitInfo::ProfileBuffer *) &profileData->method.block[0]; + *pBlockCounts = (ICorJitInfo::BlockCounts *) &profileData->method.block[0]; *pCount = profileData->method.cBlock; // If the ILSize is non-zero the the ILCodeSize also must match @@ -4026,8 +4026,8 @@ template<> void LoadTable<CORINFO_METHOD_HANDLE>::EmitLoadFixups(CORINFO_METHOD_ BOOL ZapInfo::CurrentMethodHasProfileData() { WRAPPER_NO_CONTRACT; - ULONG size; - ICorJitInfo::ProfileBuffer * profileBuffer; - return SUCCEEDED(getBBProfileData(m_currentMethodHandle, &size, &profileBuffer, NULL)); + UINT32 size; + ICorJitInfo::BlockCounts * pBlockCounts; + return SUCCEEDED(getMethodBlockCounts(m_currentMethodHandle, &size, &pBlockCounts, NULL)); } diff --git a/src/zap/zapinfo.h b/src/zap/zapinfo.h index 962bbdacd4..112bf0d6a2 100644 --- a/src/zap/zapinfo.h +++ b/src/zap/zapinfo.h @@ -307,15 +307,15 @@ public: int doAssert(const char* szFile, int iLine, const char* szExpr); void reportFatalError(CorJitResult result); - HRESULT allocBBProfileBuffer ( - ULONG cBlock, - ICorJitInfo::ProfileBuffer ** ppBlock); + HRESULT allocMethodBlockCounts ( + UINT32 count, + ICorJitInfo::BlockCounts ** pBlockCounts); - HRESULT getBBProfileData ( + HRESULT getMethodBlockCounts ( CORINFO_METHOD_HANDLE ftnHnd, - ULONG * size, - ICorJitInfo::ProfileBuffer ** profileBuffer, - ULONG * numRuns); + UINT32 * pCount, + ICorJitInfo::BlockCounts ** pBlockCounts, + UINT32 * pNumRuns); DWORD getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes); |