OpCodes.Volatile 字段

定义

指定当前位于计算堆栈顶部的地址可以是易失的,并且读取该位置的结果不能被缓存,或者对该地址的多个存储区不能被取消。Specifies that an address currently atop the evaluation stack might be volatile, and the results of reading that location cannot be cached or that multiple stores to that location cannot be suppressed.

public: static initonly System::Reflection::Emit::OpCode Volatile;
public static readonly System.Reflection.Emit.OpCode Volatile;
 staticval mutable Volatile : System.Reflection.Emit.OpCode
Public Shared ReadOnly Volatile As OpCode 

字段值

注解

下表列出了指令的十六进制和 Microsoft 中间语言(MSIL)程序集格式以及简短的参考摘要:The following table lists the instruction's hexadecimal and Microsoft Intermediate Language (MSIL) assembly format, along with a brief reference summary:

格式Format 程序集格式Assembly Format 说明Description
FE 13FE 13 失效.volatile. 指示后续指针引用是可变的。Indicates that the subsequent pointer reference is volatile.

堆栈转换行为顺序如下:The stack transitional behavior, in sequential order, is:

  1. 地址被推送到堆栈上。An address is pushed onto the stack.

volatilevolatile. 指定该地址是一个可变地址(即,可以从外部引用到当前执行线程),并且无法缓存读取该位置的结果,或者无法禁止显示此位置的多个存储。specifies that the address is a volatile address (that is, it can be referenced externally to the current thread of execution) and the results of reading that location cannot be cached or that multiple stores to that location cannot be suppressed. 将访问标记为 volatile 只影响单一访问权限;必须单独标记对同一位置的其他访问。Marking an access as volatile affects only that single access; other accesses to the same location must be marked separately. 不需要以原子方式执行对可变位置的访问。Access to volatile locations need not be performed atomically.

可以按任意顺序组合 @no__t 0 和 @no__t 前缀。The Unaligned and volatile prefixes can be combined in either order. 它们必须紧跟在 ldindstindldfldstfldldobjstobjinitblk 或 @no__t 7 指令之前。They must immediately precede a ldind, stind, ldfld, stfld, ldobj, stobj, initblk, or cpblk instruction. 对于 Ldsfld 和 @no__t 2 说明,只允许 @no__t 0 前缀。Only the volatile prefix is allowed for the Ldsfld and Stsfld instructions.

以下 @no__t 0 方法重载可以使用 @no__t 操作码:The following Emit method overload can use the volatile opcode:

  • ILGenerator.Emit(OpCode)ILGenerator.Emit(OpCode)

适用于