Rename method ICorJitInfo::allocBBProfileBuffer to ICorJitInfo::allocMethodBlockCounts
Rename method ICorJitInfo::getBBProfileData to ICorJitInfo:"getMethodBlockCounts
Rename args and use DWORD instead of ULONG for ICorJitInfo:allocMethodBlockCounts and ICorJitInfo:getMethodBlockCounts
Rename Compiler::fgProfileBuffer to Compiler::fgBlockCounts
Use an #ifdef FEATURE_CORECLR to fix the missing CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS flag on the desktop.
Make fgBlockCountsCount and fgNumProfileRuns DWORDs instead of ULONGs
Rename local var bbCurrentBlockProfileBuffer to currentBlockCounts
Rename local var bbProfileBufferStart to profileBlockCountsStart
Use DWORD when iterating over BlockCounts instead of ULONG
Rename ZapImage::hashBBProfileData to ZapImage::hashMethodBlockCounts
SuperPMI - Fixed all references to allocBBProfileBuffer => allocMethodBlockCounts
SuperPMI - fixed all reference to getBBProfileBuffer => getMethodBlockCounts
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;
}
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
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);
#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)
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;
// 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(DWORD 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,
+ DWORD* pCount, // The number of basic blocks that we have
+ BlockCounts** pBlockCounts,
+ DWORD* 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
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)
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,
+ DWORD* pCount,
+ ICorJitInfo::BlockCounts** pBlockCounts,
+ DWORD* 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,
+ DWORD* pCount,
+ ICorJitInfo::BlockCounts** pBlockCounts,
+ DWORD* 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 = (ULONG)tempValue.count;
+ *pBlockCounts = (ICorJitInfo::BlockCounts*)GetMethodBlockCounts->GetBuffer(tempValue.pBlockCounts_index);
+ *pNumRuns = (ULONG)tempValue.numRuns;
HRESULT result = (HRESULT)tempValue.result;
return result;
}
DWORDLONG method;
DWORDLONG delegateCls;
};
- struct Agnostic_GetBBProfileData
+ struct Agnostic_GetMethodBlockCounts
{
DWORD count;
- DWORD profileBuffer_index;
+ DWORD pBlockCounts_index;
DWORD numRuns;
DWORD result;
};
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,
+ void recGetMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd,
+ DWORD* pCount,
+ ICorJitInfo::BlockCounts** pBlockCounts,
+ DWORD* pNumRuns,
HRESULT result);
- void dmpGetBBProfileData(DWORDLONG key, const Agnostic_GetBBProfileData& value);
- HRESULT repGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
- ULONG* count,
- ICorJitInfo::ProfileBuffer** profileBuffer,
- ULONG* numRuns);
+ void dmpGetMethodBlockCounts(DWORDLONG key, const Agnostic_GetMethodBlockCounts& value);
+ HRESULT repGetMethodBlockCounts(CORINFO_METHOD_HANDLE ftnHnd,
+ DWORD* pCount,
+ ICorJitInfo::BlockCounts** pBlockCounts,
+ DWORD* pNumRuns);
void recMergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2, CORINFO_CLASS_HANDLE result);
void dmpMergeClasses(DLDL key, DWORDLONG value);
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,
Packet_ShouldEnforceCallvirtRestriction = 112,
PacketCR_AddressMap = 113,
- PacketCR_AllocBBProfileBuffer = 131,
+ PacketCR_AllocMethodBlockCounts = 131,
PacketCR_AllocGCInfo = 114,
PacketCR_AllocMem = 115,
PacketCR_AllocUnwindInfo = 132,
// 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(DWORD 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,
+ DWORD* pCount, // The number of basic blocks that we have
+ BlockCounts** pBlockCounts,
+ DWORD* pNumRuns)
+{
+ mc->cr->AddCall("getMethodBlockCounts");
+ HRESULT temp = original_ICorJitInfo->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns);
+ mc->recGetMethodBlockCounts(ftnHnd, pCount, pBlockCounts, pNumRuns, temp);
return temp;
}
}
/*
-struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA
+struct BlockCounts // Also defined here: code:CORBBTPROF_BLOCK_DATA
{
ULONG ILOffset;
ULONG 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(DWORD 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,
+ DWORD* pCount, // The number of basic blocks that we have
+ BlockCounts** pBlockCounts,
+ DWORD* 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
// 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(DWORD 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,
+ DWORD* pCount, // The number of basic blocks that we have
+ BlockCounts** pBlockCounts,
+ DWORD* 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
// 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(DWORD 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,
+ DWORD* pCount, // The number of basic blocks that we have
+ BlockCounts** pBlockCounts,
+ DWORD* 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
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;
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;
// 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 (
+ DWORD 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
+ DWORD * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples
+ BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples
+ DWORD * 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
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)
API_LEAVE(reportFatalError);
}
-HRESULT WrapICorJitInfo::allocBBProfileBuffer(
- ULONG count,
- ProfileBuffer **profileBuffer)
+HRESULT WrapICorJitInfo::allocMethodBlockCounts(
+ DWORD 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)
+ DWORD *pCount,
+ BlockCounts **pBlockCounts,
+ DWORD *numRuns)
{
- API_ENTER(getBBProfileData);
- HRESULT temp = wrapHnd->getBBProfileData(ftnHnd, count, profileBuffer, numRuns);
- API_LEAVE(getBBProfileData);
+ API_ENTER(getMethodBlockCounts);
+ HRESULT temp = wrapHnd->getMethodBlockCounts(ftnHnd, pCount, pBlockCounts, numRuns);
+ API_LEAVE(getMethodBlockCounts);
return temp;
}
#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
}
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;
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();
void fgAdjustForAddressExposedOrWrittenThis();
- bool fgProfileData_ILSizeMismatch;
- ICorJitInfo::ProfileBuffer* fgProfileBuffer;
- ULONG fgProfileBufferCount;
- ULONG fgNumProfileRuns;
+ bool fgProfileData_ILSizeMismatch;
+ ICorJitInfo::BlockCounts* fgBlockCounts;
+ DWORD fgBlockCountsCount;
+ DWORD fgNumProfileRuns;
unsigned fgStressBBProf()
{
return false;
}
- return (fgProfileBuffer != nullptr);
+ return (fgBlockCounts != nullptr);
}
bool Compiler::fgGetProfileWeightForBasicBlock(IL_OFFSET offset, unsigned* weightWB)
}
noway_assert(!compIsForInlining());
- for (unsigned i = 0; i < fgProfileBufferCount; i++)
+ for (DWORD 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;
// 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;
}
else
{
- noway_assert(!"Error: failed to allocate bbProfileBuffer");
+ noway_assert(!"Error: failed to allocate profileBlockCounts");
return;
}
}
// 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)
{
}
// 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 =
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
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);
// 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;
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)
}
// Reset all of the basic block counts to zero
- for (ULONG i=0; (i < pInfo->method.cBlock); i++ )
+ for (DWORD i=0; (i < pInfo->method.cBlock); i++ )
{
//
// If methodWasExecuted is false then every block's ExecutionCount should also be zero
}
#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);
}
/*********************************************************************/
-HRESULT CEEJitInfo::allocBBProfileBuffer (
- ULONG count,
- ICorJitInfo::ProfileBuffer ** profileBuffer
+HRESULT CEEJitInfo::allocMethodBlockCounts (
+ DWORD count, // count of <ILOffset, ExecutionCount> tuples
+ ICorJitInfo::BlockCounts ** pBlockCounts // pointer to array of <ILOffset, ExecutionCount> tuples
)
{
CONTRACTL {
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
// 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
+ DWORD * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples
+ ICorJitInfo::BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples
+ DWORD * pNumRuns
)
{
LIMITED_METHOD_CONTRACT;
- _ASSERTE(!"getBBProfileData not implemented on CEEJitInfo!");
+ _ASSERTE(!"getMethodBlockCounts not implemented on CEEJitInfo!");
return E_NOTIMPL;
}
UNREACHABLE(); // only called on derived class.
}
-HRESULT CEEInfo::allocBBProfileBuffer (
- ULONG count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer
+HRESULT CEEInfo::allocMethodBlockCounts (
+ DWORD 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
+ DWORD * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples
+ BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples
+ DWORD * pNumRuns
)
{
LIMITED_METHOD_CONTRACT;
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 (
+ DWORD 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
+ DWORD * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples
+ BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples
+ DWORD * pNumRuns
);
void recordCallSite(
);
- HRESULT allocBBProfileBuffer (
- ULONG count, // The number of basic blocks that we have
- ICorJitInfo::ProfileBuffer ** profileBuffer
+ HRESULT allocMethodBlockCounts (
+ DWORD 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
+ DWORD * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples
+ BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples
+ DWORD * pNumRuns
);
void recordCallSite(
return hr;
}
-HRESULT ZapImage::hashBBProfileData ()
+HRESULT ZapImage::hashMethodBlockCounts()
{
ProfileDataSection * DataSection_MethodBlockCounts = & m_profileDataSections[MethodBlockCounts];
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();
hr = parseProfileData();
if (hr == S_OK)
{
- hr = hashBBProfileData();
+ hr = hashMethodBlockCounts();
}
}
}
}
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();
return m_pEEJitInfo->runWithErrorTrap(function, param);
}
-HRESULT ZapInfo::allocBBProfileBuffer (
- ULONG cBlock,
- ICorJitInfo::ProfileBuffer ** ppBlock
+HRESULT ZapInfo::allocMethodBlockCounts (
+ DWORD 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;
}
// 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,
+ DWORD * pCount, // pointer to the count of <ILOffset, ExecutionCount> tuples
+ BlockCounts ** pBlockCounts, // pointer to array of <ILOffset, ExecutionCount> tuples
+ DWORD * 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,
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);
_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
BOOL ZapInfo::CurrentMethodHasProfileData()
{
WRAPPER_NO_CONTRACT;
- ULONG size;
- ICorJitInfo::ProfileBuffer * profileBuffer;
- return SUCCEEDED(getBBProfileData(m_currentMethodHandle, &size, &profileBuffer, NULL));
+ DWORD size;
+ ICorJitInfo::BlockCounts * pBlockCounts;
+ return SUCCEEDED(getMethodBlockCounts(m_currentMethodHandle, &size, &pBlockCounts, NULL));
}
int doAssert(const char* szFile, int iLine, const char* szExpr);
void reportFatalError(CorJitResult result);
- HRESULT allocBBProfileBuffer (
- ULONG cBlock,
- ICorJitInfo::ProfileBuffer ** ppBlock);
+ HRESULT allocMethodBlockCounts (
+ DWORD count,
+ ICorJitInfo::BlockCounts ** pBlockCounts);
- HRESULT getBBProfileData (
+ HRESULT getMethodBlockCounts (
CORINFO_METHOD_HANDLE ftnHnd,
- ULONG * size,
- ICorJitInfo::ProfileBuffer ** profileBuffer,
- ULONG * numRuns);
+ DWORD * pCount,
+ ICorJitInfo::BlockCounts ** pBlockCounts,
+ DWORD * pNumRuns);
DWORD getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes);