OpCodes 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供ILGenerator类成员(如 Emit(OpCode))发出Microsoft中间语言(MSIL)指令的字段表示形式。
public ref class OpCodes
public class OpCodes
[System.Runtime.InteropServices.ComVisible(true)]
public class OpCodes
type OpCodes = class
[<System.Runtime.InteropServices.ComVisible(true)>]
type OpCodes = class
Public Class OpCodes
- 继承
-
OpCodes
- 属性
示例
以下示例演示了使用ILGenerator向 a MethodBuilder发出OpCodes动态方法的构造。
using System;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;
class EmitWriteLineDemo {
public static Type CreateDynamicType() {
Type[] ctorParams = new Type[] {typeof(int),
typeof(int)};
AppDomain myDomain = Thread.GetDomain();
AssemblyName myAsmName = new AssemblyName();
myAsmName.Name = "MyDynamicAssembly";
AssemblyBuilder myAsmBuilder = myDomain.DefineDynamicAssembly(
myAsmName,
AssemblyBuilderAccess.Run);
ModuleBuilder pointModule = myAsmBuilder.DefineDynamicModule("PointModule",
"Point.dll");
TypeBuilder pointTypeBld = pointModule.DefineType("Point",
TypeAttributes.Public);
FieldBuilder xField = pointTypeBld.DefineField("x", typeof(int),
FieldAttributes.Public);
FieldBuilder yField = pointTypeBld.DefineField("y", typeof(int),
FieldAttributes.Public);
Type objType = Type.GetType("System.Object");
ConstructorInfo objCtor = objType.GetConstructor(new Type[0]);
ConstructorBuilder pointCtor = pointTypeBld.DefineConstructor(
MethodAttributes.Public,
CallingConventions.Standard,
ctorParams);
ILGenerator ctorIL = pointCtor.GetILGenerator();
// First, you build the constructor.
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Call, objCtor);
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_1);
ctorIL.Emit(OpCodes.Stfld, xField);
ctorIL.Emit(OpCodes.Ldarg_0);
ctorIL.Emit(OpCodes.Ldarg_2);
ctorIL.Emit(OpCodes.Stfld, yField);
ctorIL.Emit(OpCodes.Ret);
// Now, you'll build a method to output some information on the
// inside your dynamic class. This method will have the following
// definition in C#:
// public void WritePoint()
MethodBuilder writeStrMthd = pointTypeBld.DefineMethod(
"WritePoint",
MethodAttributes.Public,
typeof(void),
null);
ILGenerator writeStrIL = writeStrMthd.GetILGenerator();
// The below ILGenerator created demonstrates a few ways to create
// string output through STDIN.
// ILGenerator.EmitWriteLine(string) will generate a ldstr and a
// call to WriteLine for you.
writeStrIL.EmitWriteLine("The value of this current instance is:");
// Here, you will do the hard work yourself. First, you need to create
// the string we will be passing and obtain the correct WriteLine overload
// for said string. In the below case, you are substituting in two values,
// so the chosen overload is Console.WriteLine(string, object, object).
String inStr = "({0}, {1})";
Type[] wlParams = new Type[] {typeof(string),
typeof(object),
typeof(object)};
// We need the MethodInfo to pass into EmitCall later.
MethodInfo writeLineMI = typeof(Console).GetMethod(
"WriteLine",
wlParams);
// Push the string with the substitutions onto the stack.
// This is the first argument for WriteLine - the string one.
writeStrIL.Emit(OpCodes.Ldstr, inStr);
// Since the second argument is an object, and it corresponds to
// to the substitution for the value of our integer field, you
// need to box that field to an object. First, push a reference
// to the current instance, and then push the value stored in
// field 'x'. We need the reference to the current instance (stored
// in local argument index 0) so Ldfld can load from the correct
// instance (this one).
writeStrIL.Emit(OpCodes.Ldarg_0);
writeStrIL.Emit(OpCodes.Ldfld, xField);
// Now, we execute the box opcode, which pops the value of field 'x',
// returning a reference to the integer value boxed as an object.
writeStrIL.Emit(OpCodes.Box, typeof(int));
// Atop the stack, you'll find our string inStr, followed by a reference
// to the boxed value of 'x'. Now, you need to likewise box field 'y'.
writeStrIL.Emit(OpCodes.Ldarg_0);
writeStrIL.Emit(OpCodes.Ldfld, yField);
writeStrIL.Emit(OpCodes.Box, typeof(int));
// Now, you have all of the arguments for your call to
// Console.WriteLine(string, object, object) atop the stack:
// the string InStr, a reference to the boxed value of 'x', and
// a reference to the boxed value of 'y'.
// Call Console.WriteLine(string, object, object) with EmitCall.
writeStrIL.EmitCall(OpCodes.Call, writeLineMI, null);
// Lastly, EmitWriteLine can also output the value of a field
// using the overload EmitWriteLine(FieldInfo).
writeStrIL.EmitWriteLine("The value of 'x' is:");
writeStrIL.EmitWriteLine(xField);
writeStrIL.EmitWriteLine("The value of 'y' is:");
writeStrIL.EmitWriteLine(yField);
// Since we return no value (void), the ret opcode will not
// return the top stack value.
writeStrIL.Emit(OpCodes.Ret);
return pointTypeBld.CreateType();
}
public static void Main() {
object[] ctorParams = new object[2];
Console.Write("Enter a integer value for X: ");
string myX = Console.ReadLine();
Console.Write("Enter a integer value for Y: ");
string myY = Console.ReadLine();
Console.WriteLine("---");
ctorParams[0] = Convert.ToInt32(myX);
ctorParams[1] = Convert.ToInt32(myY);
Type ptType = CreateDynamicType();
object ptInstance = Activator.CreateInstance(ptType, ctorParams);
ptType.InvokeMember("WritePoint",
BindingFlags.InvokeMethod,
null,
ptInstance,
new object[0]);
}
}
Imports System.Threading
Imports System.Reflection
Imports System.Reflection.Emit
_
Class EmitWriteLineDemo
Public Shared Function CreateDynamicType() As Type
Dim ctorParams() As Type = {GetType(Integer), GetType(Integer)}
Dim myDomain As AppDomain = Thread.GetDomain()
Dim myAsmName As New AssemblyName()
myAsmName.Name = "MyDynamicAssembly"
Dim myAsmBuilder As AssemblyBuilder = myDomain.DefineDynamicAssembly(myAsmName, AssemblyBuilderAccess.RunAndSave)
Dim pointModule As ModuleBuilder = myAsmBuilder.DefineDynamicModule("PointModule", "Point.dll")
Dim pointTypeBld As TypeBuilder = pointModule.DefineType("Point", _
TypeAttributes.Public)
Dim xField As FieldBuilder = pointTypeBld.DefineField("x", _
GetType(Integer), _
FieldAttributes.Public)
Dim yField As FieldBuilder = pointTypeBld.DefineField("y", _
GetType(Integer), _
FieldAttributes.Public)
Dim objType As Type = Type.GetType("System.Object")
Dim objCtor As ConstructorInfo = objType.GetConstructor(New Type(){})
Dim pointCtor As ConstructorBuilder = pointTypeBld.DefineConstructor( _
MethodAttributes.Public, _
CallingConventions.Standard, _
ctorParams)
Dim ctorIL As ILGenerator = pointCtor.GetILGenerator()
' First, you build the constructor.
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Call, objCtor)
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_1)
ctorIL.Emit(OpCodes.Stfld, xField)
ctorIL.Emit(OpCodes.Ldarg_0)
ctorIL.Emit(OpCodes.Ldarg_2)
ctorIL.Emit(OpCodes.Stfld, yField)
ctorIL.Emit(OpCodes.Ret)
' Now, you'll build a method to output some information on the
' inside your dynamic class. This method will have the following
' definition in C#:
' Public Sub WritePoint()
Dim writeStrMthd As MethodBuilder = pointTypeBld.DefineMethod("WritePoint", _
MethodAttributes.Public, _
Nothing, Nothing)
Dim writeStrIL As ILGenerator = writeStrMthd.GetILGenerator()
' The below ILGenerator created demonstrates a few ways to create
' string output through STDIN.
' ILGenerator.EmitWriteLine(string) will generate a ldstr and a
' call to WriteLine for you.
writeStrIL.EmitWriteLine("The value of this current instance is:")
' Here, you will do the hard work yourself. First, you need to create
' the string we will be passing and obtain the correct WriteLine overload
' for said string. In the below case, you are substituting in two values,
' so the chosen overload is Console.WriteLine(string, object, object).
Dim inStr As [String] = "({0}, {1})"
Dim wlParams() As Type = {GetType(String), GetType(Object), GetType(Object)}
' We need the MethodInfo to pass into EmitCall later.
Dim writeLineMI As MethodInfo = GetType(Console).GetMethod("WriteLine", wlParams)
' Push the string with the substitutions onto the stack.
' This is the first argument for WriteLine - the string one.
writeStrIL.Emit(OpCodes.Ldstr, inStr)
' Since the second argument is an object, and it corresponds to
' to the substitution for the value of our integer field, you
' need to box that field to an object. First, push a reference
' to the current instance, and then push the value stored in
' field 'x'. We need the reference to the current instance (stored
' in local argument index 0) so Ldfld can load from the correct
' instance (this one).
writeStrIL.Emit(OpCodes.Ldarg_0)
writeStrIL.Emit(OpCodes.Ldfld, xField)
' Now, we execute the box opcode, which pops the value of field 'x',
' returning a reference to the integer value boxed as an object.
writeStrIL.Emit(OpCodes.Box, GetType(Integer))
' Atop the stack, you'll find our string inStr, followed by a reference
' to the boxed value of 'x'. Now, you need to likewise box field 'y'.
writeStrIL.Emit(OpCodes.Ldarg_0)
writeStrIL.Emit(OpCodes.Ldfld, yField)
writeStrIL.Emit(OpCodes.Box, GetType(Integer))
' Now, you have all of the arguments for your call to
' Console.WriteLine(string, object, object) atop the stack:
' the string InStr, a reference to the boxed value of 'x', and
' a reference to the boxed value of 'y'.
' Call Console.WriteLine(string, object, object) with EmitCall.
writeStrIL.EmitCall(OpCodes.Call, writeLineMI, Nothing)
' Lastly, EmitWriteLine can also output the value of a field
' using the overload EmitWriteLine(FieldInfo).
writeStrIL.EmitWriteLine("The value of 'x' is:")
writeStrIL.EmitWriteLine(xField)
writeStrIL.EmitWriteLine("The value of 'y' is:")
writeStrIL.EmitWriteLine(yField)
' Since we return no value (void), the ret opcode will not
' return the top stack value.
writeStrIL.Emit(OpCodes.Ret)
Return pointTypeBld.CreateType()
End Function 'CreateDynamicType
Public Shared Sub Main()
Dim ctorParams(1) As Object
Console.Write("Enter a integer value for X: ")
Dim myX As String = Console.ReadLine()
Console.Write("Enter a integer value for Y: ")
Dim myY As String = Console.ReadLine()
Console.WriteLine("---")
ctorParams(0) = Convert.ToInt32(myX)
ctorParams(1) = Convert.ToInt32(myY)
Dim ptType As Type = CreateDynamicType()
Dim ptInstance As Object = Activator.CreateInstance(ptType, ctorParams)
ptType.InvokeMember("WritePoint", _
BindingFlags.InvokeMethod, _
Nothing, ptInstance, Nothing)
End Sub
End Class
注解
有关成员操作码的详细说明,请参阅公共语言基础结构(CLI)文档,特别是“Partition III: CIL 指令集”和“Partition II:元数据定义和语义”。 有关详细信息,请参阅 ECMA 335 公共语言基础结构(CLI)。
字段
| 名称 | 说明 |
|---|---|
| Add |
将两个值相加,并将结果推送到计算堆栈。 |
| Add_Ovf |
添加两个整数,执行溢出检查,并将结果推送到计算堆栈。 |
| Add_Ovf_Un |
添加两个无符号整数值,执行溢出检查,并将结果推送到评估堆栈。 |
| And |
计算两个值的按位 AND 并将结果推送到计算堆栈。 |
| Arglist |
返回指向当前方法的参数列表的非托管指针。 |
| Beq |
如果两个值相等,则将控制权传输到目标指令。 |
| Beq_S |
如果两个值相等,则将控制权传输到目标指令(短格式)。 |
| Bge |
如果第一个值大于或等于第二个值,则将控制权传输到目标指令。 |
| Bge_S |
如果第一个值大于或等于第二个值,则将控制权传输到目标指令(短格式)。 |
| Bge_Un |
如果第一个值大于第二个值,则当比较无符号整数值或无序浮点值时,将控制权传输到目标指令。 |
| Bge_Un_S |
如果第一个值大于第二个值,则当比较无符号整数值或无序浮点值时,将控制权传输到目标指令(短形式)。 |
| Bgt |
如果第一个值大于第二个值,则将控制权传输到目标指令。 |
| Bgt_S |
如果第一个值大于第二个值,则将控制权传输到目标指令(短格式)。 |
| Bgt_Un |
如果第一个值大于第二个值,则当比较无符号整数值或无序浮点值时,将控制权传输到目标指令。 |
| Bgt_Un_S |
如果第一个值大于第二个值,则当比较无符号整数值或无序浮点值时,将控制权传输到目标指令(短形式)。 |
| Ble |
如果第一个值小于或等于第二个值,则将控制权传输到目标指令。 |
| Ble_S |
如果第一个值小于或等于第二个值,则将控制权传输到目标指令(短格式)。 |
| Ble_Un |
比较无符号整数值或无序浮点值时,如果第一个值小于或等于第二个值,则将控制权传输到目标指令。 |
| Ble_Un_S |
如果第一个值小于或等于第二个值,则当比较无符号整数值或无序浮点值时,将控制权传输到目标指令(短形式)。 |
| Blt |
如果第一个值小于第二个值,则将控制权传输到目标指令。 |
| Blt_S |
如果第一个值小于第二个值,则将控制权传输到目标指令(短格式)。 |
| Blt_Un |
比较无符号整数值或无序浮点值时,如果第一个值小于第二个值,则将控制权传输到目标指令。 |
| Blt_Un_S |
比较无符号整数值或无序浮点值时,如果第一个值小于第二个值,则将控制权传输到目标指令(短形式)。 |
| Bne_Un |
当两个无符号整数值或无序浮点值不相等时,将控制权传输到目标指令。 |
| Bne_Un_S |
当两个无符号整数值或无序浮点值不相等时,将控制传输到目标指令(短格式)。 |
| Box |
将值类型转换为对象引用(类型 |
| Br |
无条件地将控制转移到目标指令。 |
| Br_S |
无条件地将控制权转移到目标指令(简短形式)。 |
| Break |
向公共语言基础结构(CLI)发出信号,通知调试器断点已被尝试。 |
| Brfalse |
如果 |
| Brfalse_S |
将控制权传输到目标指令(如果 |
| Brtrue |
如果 |
| Brtrue_S |
如果 |
| Call |
调用传递的方法描述符指示的方法。 |
| Calli |
使用调用约定描述的参数调用计算堆栈上指示的方法(作为指向入口点的指针)。 |
| Callvirt |
对对象调用后期绑定方法,将返回值推送到计算堆栈。 |
| Castclass |
尝试强制转换通过对指定类的引用传递的对象。 |
| Ceq |
比较两个值。 如果它们相等,则整数值 1 |
| Cgt |
比较两个值。 如果第一个值大于第二个值,则整数值 1 |
| Cgt_Un |
比较两个无符号或无序值。 如果第一个值大于第二个值,则整数值 1 |
| Ckfinite |
如果值不是有限数,则 ArithmeticException 引发。 |
| Clt |
比较两个值。 如果第一个值小于第二个值,则整数值 1 |
| Clt_Un |
比较无符号或无序值 |
| Constrained |
约束执行虚拟方法调用的类型。 |
| Conv_I |
将计算堆栈顶部的值转换为 |
| Conv_I1 |
将计算堆栈顶部的值转换为 |
| Conv_I2 |
将计算堆栈顶部的值转换为 |
| Conv_I4 |
将计算堆栈顶部的值转换为 |
| Conv_I8 |
将计算堆栈顶部的值转换为 |
| Conv_Ovf_I |
将评估堆栈顶部的有符号值转换为已签名 |
| Conv_Ovf_I_Un |
将评估堆栈顶部的无符号值转换为已签名 |
| Conv_Ovf_I1 |
将评估堆栈顶部的有符号值转换为有符号 |
| Conv_Ovf_I1_Un |
将评估堆栈顶部的无符号值转换为有符号 |
| Conv_Ovf_I2 |
将评估堆栈顶部的有符号值转换为有符号 |
| Conv_Ovf_I2_Un |
将评估堆栈顶部的无符号值转换为有符号 |
| Conv_Ovf_I4 |
将评估堆栈顶部的有符号值转换为已签名 |
| Conv_Ovf_I4_Un |
将评估堆栈顶部的无符号值转换为已签名 |
| Conv_Ovf_I8 |
将评估堆栈顶部的有符号值转换为已签名 |
| Conv_Ovf_I8_Un |
将评估堆栈顶部的无符号值转换为已签名 |
| Conv_Ovf_U |
将计算堆栈顶部的有符号值转换为 |
| Conv_Ovf_U_Un |
将评估堆栈顶部的无符号值转换为 |
| Conv_Ovf_U1 |
将计算堆栈顶部的有符号值转换为计算堆栈 |
| Conv_Ovf_U1_Un |
将评估堆栈顶部的无符号值转换为计算堆栈 |
| Conv_Ovf_U2 |
将计算堆栈顶部的有符号值转换为计算堆栈 |
| Conv_Ovf_U2_Un |
将评估堆栈顶部的无符号值转换为计算堆栈 |
| Conv_Ovf_U4 |
将计算堆栈顶部的有符号值转换为 |
| Conv_Ovf_U4_Un |
将评估堆栈顶部的无符号值转换为 |
| Conv_Ovf_U8 |
将计算堆栈顶部的有符号值转换为 |
| Conv_Ovf_U8_Un |
将评估堆栈顶部的无符号值转换为 |
| Conv_R_Un |
将计算堆栈顶部的无符号整数值转换为 |
| Conv_R4 |
将计算堆栈顶部的值转换为 |
| Conv_R8 |
将计算堆栈顶部的值转换为 |
| Conv_U |
将计算堆栈 |
| Conv_U1 |
将计算堆栈 |
| Conv_U2 |
将计算堆栈 |
| Conv_U4 |
将计算堆栈 |
| Conv_U8 |
将计算堆栈 |
| Cpblk |
将指定数目的字节从源地址复制到目标地址。 |
| Cpobj |
将位于对象地址(类型 |
| Div |
将两个值除以浮点(类型 |
| Div_Un |
将两个无符号整数值除以将结果( |
| Dup |
复制评估堆栈上的当前最顶层值,然后将副本推送到评估堆栈。 |
| Endfilter |
将 |
| Endfinally |
将异常块的或 |
| Initblk |
将特定地址处的指定内存块初始化为给定大小和初始值。 |
| Initobj |
将指定地址处的值类型的每个字段初始化为 null 引用或相应基元类型的 0。 |
| Isinst |
测试对象引用(类型 |
| Jmp |
退出当前方法并跳转到指定的方法。 |
| Ldarg |
将参数(由指定的索引值引用)加载到堆栈上。 |
| Ldarg_0 |
将索引 0 处的参数加载到计算堆栈上。 |
| Ldarg_1 |
将索引 1 处的参数加载到计算堆栈上。 |
| Ldarg_2 |
将索引 2 处的参数加载到计算堆栈上。 |
| Ldarg_3 |
将索引 3 处的参数加载到计算堆栈上。 |
| Ldarg_S |
将参数(由指定的短格式索引引用)加载到计算堆栈上。 |
| Ldarga |
将参数地址加载到计算堆栈上。 |
| Ldarga_S |
以简短形式将参数地址加载到计算堆栈上。 |
| Ldc_I4 |
以计算堆栈的形式 |
| Ldc_I4_0 |
将整数值 0 作为一个 |
| Ldc_I4_1 |
将整数值 1 作为一个 |
| Ldc_I4_2 |
将整数值 2 作为一个 |
| Ldc_I4_3 |
将整数值 3 作为一个 |
| Ldc_I4_4 |
将整数值 4 作为一个 |
| Ldc_I4_5 |
将 5 的整数值作为计算 |
| Ldc_I4_6 |
将整数值 6 作为一个 |
| Ldc_I4_7 |
将整数值 7 作为一个 |
| Ldc_I4_8 |
将整数值 8 作为一个 |
| Ldc_I4_M1 |
将 -1 的整数值作为计算 |
| Ldc_I4_S |
将所提供的 |
| Ldc_I8 |
以计算堆栈的形式 |
| Ldc_R4 |
将类型的提供值 |
| Ldc_R8 |
将类型的提供值 |
| Ldelem |
将指定数组索引处的元素作为指令中指定的类型加载到计算堆栈的顶部。 |
| Ldelem_I |
将类型 |
| Ldelem_I1 |
将类型 |
| Ldelem_I2 |
将类型 |
| Ldelem_I4 |
将类型 |
| Ldelem_I8 |
将类型 |
| Ldelem_R4 |
将类型在指定数组索引处的 |
| Ldelem_R8 |
将类型在指定数组索引处的 |
| Ldelem_Ref |
将包含对象引用的元素作为类型 |
| Ldelem_U1 |
将类型 |
| Ldelem_U2 |
将类型 |
| Ldelem_U4 |
将类型 |
| Ldelema |
将指定数组索引处的数组元素的地址作为类型 |
| Ldfld |
查找对象中引用当前位于计算堆栈上的字段的值。 |
| Ldflda |
查找对象中引用当前位于计算堆栈上的字段的地址。 |
| Ldftn |
将非托管指针(类型 |
| Ldind_I |
以间接方式将类型的 |
| Ldind_I1 |
以间接方式将类型的 |
| Ldind_I2 |
以间接方式将类型的 |
| Ldind_I4 |
以间接方式将类型的 |
| Ldind_I8 |
以间接方式将类型的 |
| Ldind_R4 |
将类型值作为类型 |
| Ldind_R8 |
将类型值作为类型 |
| Ldind_Ref |
将对象引用作为类型 |
| Ldind_U1 |
以间接方式将类型的 |
| Ldind_U2 |
以间接方式将类型的 |
| Ldind_U4 |
以间接方式将类型的 |
| Ldlen |
将从零开始的一维数组的元素数推送到计算堆栈。 |
| Ldloc |
将特定索引处的局部变量加载到计算堆栈上。 |
| Ldloc_0 |
将索引 0 处的局部变量加载到计算堆栈上。 |
| Ldloc_1 |
将索引 1 处的局部变量加载到计算堆栈上。 |
| Ldloc_2 |
将索引 2 处的局部变量加载到计算堆栈上。 |
| Ldloc_3 |
将索引 3 处的局部变量加载到计算堆栈上。 |
| Ldloc_S |
将特定索引处的局部变量加载到计算堆栈(短格式)。 |
| Ldloca |
将特定索引处的局部变量的地址加载到计算堆栈上。 |
| Ldloca_S |
将特定索引处的局部变量的地址加载到计算堆栈(短格式)。 |
| Ldnull |
将 null 引用(类型 |
| Ldobj |
将地址指向的值类型对象复制到评估堆栈的顶部。 |
| Ldsfld |
将静态字段的值推送到计算堆栈。 |
| Ldsflda |
将静态字段的地址推送到评估堆栈。 |
| Ldstr |
将新的对象引用推送到存储在元数据中的字符串文本。 |
| Ldtoken |
将元数据令牌转换为其运行时表示形式,并将其推送到计算堆栈。 |
| Ldvirtftn |
将非托管指针(类型 |
| Leave |
退出受保护的代码区域,无条件地将控制转移到特定目标指令。 |
| Leave_S |
退出受保护的代码区域,无条件地将控制转移到目标指令(简短形式)。 |
| Localloc |
从本地动态内存池分配特定数量的字节,并将第一个分配字节的地址(暂时性指针类型 |
| Mkrefany |
将对特定类型的实例的类型化引用推送到评估堆栈。 |
| Mul |
将两个值相乘,并在评估堆栈上推送结果。 |
| Mul_Ovf |
将两个整数值相乘,执行溢出检查,并将结果推送到计算堆栈。 |
| Mul_Ovf_Un |
将两个无符号整数值相乘,执行溢出检查,并将结果推送到计算堆栈。 |
| Neg |
否定值并将结果推送到计算堆栈。 |
| Newarr |
将对象引用推送到一个新的从零开始的一维数组,该数组的元素属于特定类型的计算堆栈。 |
| Newobj |
创建一个新对象或值类型的新实例,将对象引用(类型 |
| Nop |
如果修补了操作码,则填充空间。 尽管可以使用处理周期,但不会执行有意义的操作。 |
| Not |
计算堆栈顶部整数值的按位补数,并将结果推送到计算堆栈上,类型相同。 |
| Or |
计算堆栈顶部的两个整数值的按位补数,并将结果推送到计算堆栈。 |
| Pop |
删除当前位于评估堆栈之上的值。 |
| Prefix1 |
这是保留的说明。 |
| Prefix2 |
这是保留的说明。 |
| Prefix3 |
这是保留的说明。 |
| Prefix4 |
这是保留的说明。 |
| Prefix5 |
这是保留的说明。 |
| Prefix6 |
这是保留的说明。 |
| Prefix7 |
这是保留的说明。 |
| Prefixref |
这是保留的说明。 |
| Readonly |
指定后续数组地址操作在运行时不执行类型检查,并返回一个受限制其可变性的托管指针。 |
| Refanytype |
检索类型化引用中嵌入的类型令牌。 |
| Refanyval |
检索嵌入在类型引用中的地址(类型 |
| Rem |
将两个值除以将余数推送到计算堆栈。 |
| Rem_Un |
将两个无符号值除以将余数推送到计算堆栈。 |
| Ret |
从当前方法返回,将返回值(如果存在)从被调用方的计算堆栈推送到调用方的计算堆栈。 |
| Rethrow |
重新引发当前异常。 |
| Shl |
将整数值向左(以零为单位)按指定的位数移动,将结果推送到计算堆栈。 |
| Shr |
将整数值(以符号为单位)向右移动指定位数,将结果推送到计算堆栈。 |
| Shr_Un |
将无符号整数值(以零为单位)向右移动指定位数,将结果推送到计算堆栈。 |
| Sizeof |
将提供的值类型的大小(以字节为单位)推送到评估堆栈。 |
| Starg |
将计算堆栈顶部的值存储在指定索引处的参数槽中。 |
| Starg_S |
将计算堆栈顶部的值存储在指定索引(短格式)的参数槽中。 |
| Stelem |
将给定索引处的数组元素替换为计算堆栈上的值,该计算堆栈的类型在指令中指定。 |
| Stelem_I |
将给定索引处的数组元素替换为 |
| Stelem_I1 |
将给定索引处的数组元素替换为 |
| Stelem_I2 |
将给定索引处的数组元素替换为 |
| Stelem_I4 |
将给定索引处的数组元素替换为 |
| Stelem_I8 |
将给定索引处的数组元素替换为 |
| Stelem_R4 |
将给定索引处的数组元素替换为 |
| Stelem_R8 |
将给定索引处的数组元素替换为 |
| Stelem_Ref |
将给定索引处的数组元素替换为计算堆栈上的对象 ref 值(类型 |
| Stfld |
将对象引用或指针字段中存储的值替换为新值。 |
| Stind_I |
将类型的 |
| Stind_I1 |
将类型的 |
| Stind_I2 |
将类型的 |
| Stind_I4 |
将类型的 |
| Stind_I8 |
将类型的 |
| Stind_R4 |
将类型的 |
| Stind_R8 |
将类型的 |
| Stind_Ref |
将对象引用值存储在提供的地址处。 |
| Stloc |
从计算堆栈顶部弹出当前值,并将其存储在指定索引处的局部变量列表中。 |
| Stloc_0 |
从计算堆栈顶部弹出当前值,并将其存储在索引 0 的局部变量列表中。 |
| Stloc_1 |
从计算堆栈顶部弹出当前值,并将其存储在索引 1 的局部变量列表中。 |
| Stloc_2 |
从计算堆栈顶部弹出当前值,并将其存储在索引 2 的局部变量列表中。 |
| Stloc_3 |
从计算堆栈顶部弹出当前值,并将其存储在索引 3 的局部变量列表中。 |
| Stloc_S |
从计算堆栈顶部弹出当前值,并将其存储在本地变量列表中 |
| Stobj |
将指定类型的值从评估堆栈复制到提供的内存地址中。 |
| Stsfld |
将静态字段的值替换为评估堆栈中的值。 |
| Sub |
从另一个值中减去一个值,并将结果推送到计算堆栈。 |
| Sub_Ovf |
从另一个整数值中减去一个整数值,执行溢出检查,并将结果推送到计算堆栈。 |
| Sub_Ovf_Un |
从另一个无符号整数值减去一个无符号整数值,执行溢出检查,并将结果推送到计算堆栈。 |
| Switch |
实现跳转表。 |
| Tailcall |
执行后缀方法调用指令,以便在执行实际调用指令之前删除当前方法的堆栈帧。 |
| Throw |
当前在计算堆栈上引发异常对象。 |
| Unaligned |
指示当前在评估堆栈上的地址可能与紧跟、、、 |
| Unbox |
将值类型的装箱表示形式转换为其未装箱窗体。 |
| Unbox_Any |
将指令中指定的类型的装箱表示形式转换为其未装箱窗体。 |
| Volatile |
指定当前位于评估堆栈上的地址可能是易失的,读取该位置的结果不能缓存,或者无法取消该位置的多个存储。 |
| Xor |
计算评估堆栈上前两个值的按位 XOR,将结果推送到计算堆栈。 |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| TakesSingleByteArgument(OpCode) |
如果提供的操作代码采用单个字节参数,则返回 true 或 false。 |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |