Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ movb引发了坏的猜测_C++_Assembly_X86 64_Clang++_Mov - Fatal编程技术网

C++ movb引发了坏的猜测

C++ movb引发了坏的猜测,c++,assembly,x86-64,clang++,mov,C++,Assembly,X86 64,Clang++,Mov,我正在研究一个并行树实现。在分析过程中,我认识到对movb操作的高度错误推测 我的数据结构如下所示: struct data { enum annotation_type : std::uint8_t { none, core, region, tree_node }; // Specifies the value in the union access_pattern _access_pattern = writing; enum priority _priority

我正在研究一个并行树实现。在分析过程中,我认识到对
movb
操作的高度错误推测

我的数据结构如下所示:

struct data {
    enum annotation_type : std::uint8_t { none, core, region, tree_node }; // Specifies the value in the union
    access_pattern _access_pattern = writing;
    enum priority _priority = priority::normal;

    annotation_type _annotation_type = annotation_type::none;
    union {
        std::uint16_t _core;
        std::uint8_t _region;
        std::pair<node*, std::uint16_t> _tree_node = {nullptr,0};
    };
};
通过
clang-10
,将
annotate
方法编译为

movb  $0x3, 0x12(%r14)   // Set _annotation_type
movq  %rax, 0x14(%r14)   // Set the pointer part of tree_node
movw  $0x200, 0x1c(%r14) // Set the size part of tree_node, in this case it is called with annotate(node*, 512)
使用“英特尔VTune分析器”,我可以确定
movb
指令
movb$0x3,0x12(%r14)
的CPI率为
4.550
,错误推测为
movb
指令
movb$0x3,0x12(%r14)
,该指令将
\u注释类型
属性更新为
0x3
树节点


但是一条
mov
指令怎么会得到如此高的错误推测,这是基于分支错误预测的,不是吗

您在任何时候都在阅读非活动工会会员的信息吗?什么是非活动工会?唯一知道在联合体中存储什么值的是
\u注释\u类型
。如果在
\u树\u节点
中存储某物,则是
\u核心
\u区域
存储
节点*
,但
注释
(成员?)函数尝试存储
常量节点*/code>。那是编译吗?@TedLyngmo啊,不,我没有访问任何一个不活跃的工会成员。你在任何时候都在阅读一个不活跃的工会成员的文章吗?什么是不活跃的工会?唯一知道在联合体中存储什么值的是
\u注释\u类型
。如果在
\u树\u节点
中存储某物,则是
\u核心
\u区域
存储
节点*
,但
注释
(成员?)函数尝试存储
常量节点*/code>。那还可以编译吗?@TedLyngmo啊,不,我没有访问一个不活跃的工会成员。
movb  $0x3, 0x12(%r14)   // Set _annotation_type
movq  %rax, 0x14(%r14)   // Set the pointer part of tree_node
movw  $0x200, 0x1c(%r14) // Set the size part of tree_node, in this case it is called with annotate(node*, 512)