首页 > 解决方案 > x86 中的发布语义是否只影响读写指令?

问题描述

x86 中的写入指令具有释放语义,本教程对释放语义的含义进行了如下说明:

释放语义防止写释放的内存重新排序与程序顺序之前的任何读或写操作。

因此,如果我有以下说明:

read_instruction_1
read_instruction_2
write_instruction_1
write_instruction_2 (the above instructions will no be reordered to below this instruction)
read_instruction_3
write_instruction_3

上面的说明write_instruction_2不会重新排序到下面 write_instruction_2


但是如果我有这样的东西怎么办:

read_instruction_1
read_instruction_2
write_instruction_1
a_non_read_or_write_instruction
write_instruction_2 (will a_non_read_or_write_instruction not be reordered to below this instruction?)
read_instruction_3
write_instruction_3

a_non_read_or_write_instruction指令不是读或写指令,但我不希望它被重新排序到下面write_instruction_2,它不会被重新排序到下面write_instruction_2吗?

标签: assemblyx86

解决方案


推荐阅读