in ProfilingAPI/ReJITEnterLeaveHooks/ILRewriter.cpp [725:752]
HRESULT AddProbe(
ILRewriter * pilr,
FunctionID functionId,
UINT_PTR methodAddress,
ULONG32 methodSignature,
ILInstr * pInsertProbeBeforeThisInstr)
{
ILInstr * pNewInstr = nullptr;
constexpr auto CEE_LDC_I = sizeof(size_t) == 8 ? CEE_LDC_I8 : sizeof(size_t) == 4 ? CEE_LDC_I4 : throw std::logic_error("size_t must be defined as 8 or 4");
pNewInstr = pilr->NewILInstr();
pNewInstr->m_opcode = CEE_LDC_I;
pNewInstr->m_Arg64 = functionId;
pilr->InsertBefore(pInsertProbeBeforeThisInstr, pNewInstr);
pNewInstr = pilr->NewILInstr();
pNewInstr->m_opcode = CEE_LDC_I;
pNewInstr->m_Arg64 = methodAddress;
pilr->InsertBefore(pInsertProbeBeforeThisInstr, pNewInstr);
pNewInstr = pilr->NewILInstr();
pNewInstr->m_opcode = CEE_CALLI;
pNewInstr->m_Arg32 = methodSignature;
pilr->InsertBefore(pInsertProbeBeforeThisInstr, pNewInstr);
return S_OK;
}