本文整理汇总了C++中StackMaps::computeRecordMap方法的典型用法代码示例。如果您正苦于以下问题:C++ StackMaps::computeRecordMap方法的具体用法?C++ StackMaps::computeRecordMap怎么用?C++ StackMaps::computeRecordMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StackMaps
的用法示例。
在下文中一共展示了StackMaps::computeRecordMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: link
void link(CompilerState& state, const LinkDesc& desc)
{
StackMaps sm;
DataView dv(state.m_stackMapsSection->data());
sm.parse(&dv);
auto rm = sm.computeRecordMap();
EMASSERT(state.m_codeSectionList.size() == 1);
uint8_t* prologue = const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(state.m_codeSectionList.front().data()));
uint8_t* body = static_cast<uint8_t*>(state.m_entryPoint);
desc.m_patchPrologue(desc.m_opaque, prologue);
for (auto& record : rm) {
EMASSERT(record.second.size() == 1);
auto found = state.m_patchMap.find(record.first);
if (found == state.m_patchMap.end()) {
// should be the tcg helpers.
continue;
}
PatchDesc& patchDesc = found->second;
switch (patchDesc.m_type) {
case PatchType::Assist: {
desc.m_patchAssist(desc.m_opaque, body + record.second[0].instructionOffset, desc.m_dispAssist);
} break;
case PatchType::TcgDirect: {
auto& recordUnit = record.second[0];
desc.m_patchTcgDirect(desc.m_opaque, body + recordUnit.instructionOffset, desc.m_dispTcgDirect);
} break;
case PatchType::TcgIndirect: {
auto& recordUnit = record.second[0];
desc.m_patchTcgIndirect(desc.m_opaque, body + recordUnit.instructionOffset, desc.m_dispTcgIndirect);
} break;
default:
EMUNREACHABLE();
}
}
}
示例2: link
void LLVMDisasContext::link()
{
StackMaps sm;
const LinkDesc desc = {
nullptr,
m_dispDirect,
m_dispIndirect,
patchProloge,
patchDirect,
patchIndirect,
};
DataView dv(state()->m_stackMapsSection->data());
sm.parse(&dv);
auto rm = sm.computeRecordMap();
EMASSERT(state()->m_codeSectionList.size() == 1);
uint8_t* prologue = state()->m_codeSectionList.front();
uint8_t* body = static_cast<uint8_t*>(state()->m_entryPoint);
desc.m_patchPrologue(desc.m_opaque, prologue);
for (auto& record : rm) {
auto found = state()->m_patchMap.find(record.first);
if (found == state()->m_patchMap.end()) {
// should be the tcg helpers.
continue;
}
PatchDesc& patchDesc = found->second;
switch (patchDesc.m_type) {
case PatchType::TcgDirect: {
for (auto& recordUnit : record.second) {
desc.m_patchTcgDirect(desc.m_opaque, body + recordUnit.instructionOffset, desc.m_dispTcgDirect);
}
} break;
case PatchType::TcgIndirect: {
for (auto& recordUnit : record.second) {
desc.m_patchTcgIndirect(desc.m_opaque, body + recordUnit.instructionOffset, desc.m_dispTcgIndirect);
}
} break;
default:
EMUNREACHABLE();
}
}
}