美文网首页辅助资料csharp
IL Opcode 完整名称、中文释义及极简示例

IL Opcode 完整名称、中文释义及极简示例

作者: 雨落随风 | 来源:发表于2024-08-18 01:17 被阅读0次

    翻译和示例由 Github Copilot AI 在笔者对话驱动下完成,可能有不准确的地方,仅供参考!
    由于网页渲染原因,可能有换行不合理的地方,请知悉!
    源数据来自 Unity MonoCecil 程序集 com.unity.nuget.mono-cecil@1.11.4\Mono.Cecil.dll

    no. opcode 完整名称 释义 C# IL
    1 Nop No operation 无操作 // No operation nop
    2 Break Break 断点 // Breakpoint break
    3 Ldarg_0 Load argument 0 加载第0个参数 void Method(int a) { int x = a; } ldarg.0
    stloc.0
    4 Ldarg_1 Load argument 1 加载第1个参数 void Method(int a, int b) { int x = b; } ldarg.1
    stloc.0
    5 Ldarg_2 Load argument 2 加载第2个参数 void Method(int a, int b, int c) { int x = c; } ldarg.2
    stloc.0
    6 Ldarg_3 Load argument 3 加载第3个参数 void Method(int a, int b, int c, int d) { int x = d; } ldarg.3
    stloc.0
    7 Ldloc_0 Load local 0 加载第0个局部变量 int x = 10; int y = x; ldc.i4.s 10
    stloc.0
    ldloc.0
    stloc.1
    8 Ldloc_1 Load local 1 加载第1个局部变量 int x = 10; int y = 20; int z = y; ldc.i4.s 10
    stloc.0
    ldc.i4.s 20
    stloc.1
    ldloc.1
    stloc.2
    9 Ldloc_2 Load local 2 加载第2个局部变量 int x = 10; int y = 20; int z = 30; int w = z; ldc.i4.s 10
    stloc.0
    ldc.i4.s 20
    stloc.1
    ldc.i4.s 30
    stloc.2
    ldloc.2
    stloc.3
    10 Ldloc_3 Load local 3 加载第3个局部变量 int x = 10; int y = 20; int z = 30; int w = 40; int v = w; ldc.i4.s 10
    stloc.0
    ldc.i4.s 20
    stloc.1
    ldc.i4.s 30
    stloc.2
    ldc.i4.s 40
    stloc.3
    ldloc.3
    stloc.s 4
    11 Stloc_0 Store local 0 存储到第0个局部变量 int x; x = 10; ldc.i4.s 10
    stloc.0
    12 Stloc_1 Store local 1 存储到第1个局部变量 int x, y; x = 10; y = 20; ldc.i4.s 10
    stloc.0
    ldc.i4.s 20
    stloc.1
    13 Stloc_2 Store local 2 存储到第2个局部变量 int x, y, z; x = 10; y = 20; z = 30; ldc.i4.s 10
    stloc.0
    ldc.i4.s 20
    stloc.1
    ldc.i4.s 30
    stloc.2
    14 Stloc_3 Store local 3 存储到第3个局部变量 int x, y, z, w; x = 10; y = 20; z = 30; w = 40; ldc.i4.s 10
    stloc.0
    ldc.i4.s 20
    stloc.1
    ldc.i4.s 30
    stloc.2
    ldc.i4.s 40
    stloc.3
    15 Ldarg_S Load argument short 短格式加载参数 void Method(int a) { int x = a; } ldarg.s 0
    stloc.0
    16 Ldarga_S Load argument address short 短格式加载参数地址 void Method(int a) { int* ptr = &a; } ldarga.s 0
    stloc.0
    17 Starg_S Store argument short 短格式存储参数 void Method(int a) { a = 10; } ldc.i4.s 10
    starg.s 0
    18 Ldloc_S Load local short 短格式加载局部变量 int x = 10; int y = x; ldc.i4.s 10
    stloc.s 0
    ldloc.s 0
    stloc.s 1
    19 Ldloca_S Load local address short 短格式加载局部变量地址 int x = 10; int* ptr = &x; ldc.i4.s 10
    stloc.s 0
    ldloca.s 0
    stloc.s 1
    20 Stloc_S Store local short 短格式存储局部变量 int x; x = 10; ldc.i4.s 10
    stloc.s 0
    21 Ldnull Load null 加载null object obj = null; ldnull
    stloc.s 0
    22 Ldc_I4_M1 Load constant int -1 加载整数-1 int x = -1; ldc.i4.m1
    stloc.s 0
    23 Ldc_I4_0 Load constant int 0 加载整数0 int x = 0; ldc.i4.0
    stloc.s 0
    24 Ldc_I4_1 Load constant int 1 加载整数1 int x = 1; ldc.i4.1
    stloc.s 0
    25 Ldc_I4_2 Load constant int 2 加载整数2 int x = 2; ldc.i4.2
    stloc.s 0
    26 Ldc_I4_3 Load constant int 3 加载整数3 int x = 3; ldc.i4.3
    stloc.s 0
    27 Ldc_I4_4 Load constant int 4 加载整数4 int x = 4; ldc.i4.4
    stloc.s 0
    28 Ldc_I4_5 Load constant int 5 加载整数5 int x = 5; ldc.i4.5
    stloc.s 0
    29 Ldc_I4_6 Load constant int 6 加载整数6 int x = 6; ldc.i4.6
    stloc.s 0
    30 Ldc_I4_7 Load constant int 7 加载整数7 int x = 7; ldc.i4.7
    stloc.s 0
    31 Ldc_I4_8 Load constant int 8 加载整数8 int x = 8; ldc.i4.8
    stloc.s 0
    32 Ldc_I4_S Load constant int short 短格式加载整数 int x = 100; ldc.i4.s 100
    stloc.s 0
    33 Ldc_I4 Load constant int 加载整数 int x = 1000; ldc.i4 1000
    stloc.s 0
    34 Ldc_I8 Load constant long 加载长整数 long x = 100L; ldc.i8 100
    stloc.s 0
    35 Ldc_R4 Load constant float 加载单精度浮点数 float x = 1.23f; ldc.r4 1.23
    stloc.s 0
    36 Ldc_R8 Load constant double 加载双精度浮点数 double x = 1.23; ldc.r8 1.23
    stloc.s 0
    37 Dup Duplicate 复制栈顶元素 int x = 10; int y = x; ldc.i4.s 10
    dup
    stloc.s 0
    stloc.s 1
    38 Pop Pop 弹出栈顶元素 int x = 10; x = 20; ldc.i4.s 10
    stloc.s 0
    ldc.i4.s 20
    pop
    stloc.s 0
    39 Jmp Jump 跳转 // Jump to method jmp method
    40 Call Call 调用方法 Console.WriteLine("Hello"); ldstr "Hello"
    call void [mscorlib]System.Console::WriteLine(string)
    41 Calli Call indirect 调用间接方法 // Call indirect calli
    42 Ret Return 返回 return; ret
    43 Br_S Branch short 短格式无条件跳转 goto Label; br.s Label
    44 Brfalse_S Branch if false short 短格式为假跳转 if (!condition) goto Label; ldloc.0
    brfalse.s Label
    45 Brtrue_S Branch if true short 短格式为真跳转 if (condition) goto Label; ldloc.0
    brtrue.s Label
    46 Beq_S Branch if equal short 短格式相等跳转 if (x == y) goto Label; ldloc.0
    ldloc.1
    beq.s Label
    47 Bge_S Branch if greater or equal short 短格式大于等于跳转 if (x >= y) goto Label; ldloc.0
    ldloc.1
    bge.s Label
    48 Bgt_S Branch if greater short 短格式大于跳转 if (x > y) goto Label; ldloc.0
    ldloc.1
    bgt.s Label
    49 Ble_S Branch if less or equal short 短格式小于等于跳转 if (x <= y) goto Label; ldloc.0
    ldloc.1
    ble.s Label
    50 Blt_S Branch if less short 短格式小于跳转 if (x < y) goto Label; ldloc.0
    ldloc.1
    blt.s Label
    51 Bne_Un_S Branch if Not Equal, Short form 短格式的条件分支指令,当两个值不相等时跳转 if (x != y) goto Label; ldloc.0
    ldloc.1
    bne.un.s Label
    52 Bge_Un_S Branch if Greater or Equal, Unsigned, Short form 短格式的条件分支指令,当第一个值大于或等于第二个值(无符号比较)时跳转 if (x >= y) goto Label; ldloc.0
    ldloc.1
    bge.un.s Label
    53 Bgt_Un_S Branch if Greater Than, Unsigned, Short form 短格式的条件分支指令,当第一个值大于第二个值(无符号比较)时跳转 if (x > y) goto Label; ldloc.0
    ldloc.1
    bgt.un.s Label
    54 Ble_Un_S Branch if Less or Equal, Unsigned, Short form 短格式的条件分支指令,当第一个值小于或等于第二个值(无符号比较)时跳转 if (x <= y) goto Label; ldloc.0
    ldloc.1
    ble.un.s Label
    55 Blt_Un_S Branch if Less Than, Unsigned, Short form 短格式的条件分支指令,当第一个值小于第二个值(无符号比较)时跳转 if (x < y) goto Label; ldloc.0
    ldloc.1
    blt.un.s Label
    56 Br Branch 无条件分支指令 goto Label; br Label
    57 Brfalse Branch if False 条件分支指令,当栈顶值为假时跳转 if (!condition) goto Label; ldloc.0
    brfalse Label
    58 Brtrue Branch if True 条件分支指令,当栈顶值为真时跳转 if (condition) goto Label; ldloc.0
    brtrue Label
    59 Beq Branch if Equal 条件分支指令,当两个值相等时跳转 if (x == y) goto Label; ldloc.0
    ldloc.1
    beq Label
    60 Bge Branch if Greater or Equal 条件分支指令,当第一个值大于或等于第二个值时跳转 if (x >= y) goto Label; ldloc.0
    ldloc.1
    bge Label
    61 Bgt Branch if Greater Than 条件分支指令,当第一个值大于第二个值时跳转 if (x > y) goto Label; ldloc.0
    ldloc.1
    bgt Label
    62 Ble Branch if Less or Equal 条件分支指令,当第一个值小于或等于第二个值时跳转 if (x <= y) goto Label; ldloc.0
    ldloc.1
    ble Label
    63 Blt Branch if Less Than 条件分支指令,当第一个值小于第二个值时跳转 if (x < y) goto Label; ldloc.0
    ldloc.1
    blt Label
    64 Bne_Un Branch if Not Equal, Unsigned 条件分支指令,当两个值不相等(无符号比较)时跳转 if (x != y) goto Label; ldloc.0
    ldloc.1
    bne.un Label
    65 Bge_Un Branch if Greater or Equal, Unsigned 条件分支指令,当第一个值大于或等于第二个值(无符号比较)时跳转 if (x >= y) goto Label; ldloc.0
    ldloc.1
    bge.un Label
    66 Bgt_Un Branch if Greater Than, Unsigned 条件分支指令,当第一个值大于第二个值(无符号比较)时跳转 if (x > y) goto Label; ldloc.0
    ldloc.1
    bgt.un Label
    67 Ble_Un Branch if Less or Equal, Unsigned 条件分支指令,当第一个值小于或等于第二个值(无符号比较)时跳转 if (x <= y) goto Label; ldloc.0
    ldloc.1
    ble.un Label
    68 Blt_Un Branch if Less Than, Unsigned 条件分支指令,当第一个值小于第二个值(无符号比较)时跳转 if (x < y) goto Label; ldloc.0
    ldloc.1
    blt.un Label
    69 Switch Switch 多路分支指令 switch (x) { case 1: break; case 2: break; } ldloc.0
    switch (targets)
    70 Ldind_I1 Load Indirect, Int8 从地址加载一个8位整数 sbyte x = (sbyte)ptr; ldind.i1
    71 Ldind_U1 Load Indirect, Unsigned Int8 从地址加载一个无符号8位整数 byte x = (byte)ptr; ldind.u1
    72 Ldind_I2 Load Indirect, Int16 从地址加载一个16位整数 short x = (short)ptr; ldind.i2
    73 Ldind_U2 Load Indirect, Unsigned Int16 从地址加载一个无符号16位整数 ushort x = (ushort)ptr; ldind.u2
    74 Ldind_I4 Load Indirect, Int32 从地址加载一个32位整数 int x = (int)ptr; ldind.i4
    75 Ldind_U4 Load Indirect, Unsigned Int32 从地址加载一个无符号32位整数 uint x = (uint)ptr; ldind.u4
    76 Ldind_I8 Load Indirect, Int64 从地址加载一个64位整数 long x = (long)ptr; ldind.i8
    77 Ldind_I Load Indirect, Native Int 从地址加载一个本机整数 IntPtr x = (IntPtr)ptr; ldind.i
    78 Ldind_R4 Load Indirect, Float32 从地址加载一个32位浮点数 float x = (float)ptr; ldind.r4
    79 Ldind_R8 Load Indirect, Float64 从地址加载一个64位浮点数 double x = (double)ptr; ldind.r8
    80 Ldind_Ref Load Indirect, Reference 从地址加载一个对象引用 object x = (object)ptr; ldind.ref
    81 Stind_Ref Store Indirect, Reference 将对象引用存储到地址 (object)ptr = x; stind.ref
    82 Stind_I1 Store Indirect, Int8 将8位整数存储到地址 (sbyte)ptr = x; stind.i1
    83 Stind_I2 Store Indirect, Int16 将16位整数存储到地址 (short)ptr = x; stind.i2
    84 Stind_I4 Store Indirect, Int32 将32位整数存储到地址 (int)ptr = x; stind.i4
    85 Stind_I8 Store Indirect, Int64 将64位整数存储到地址 (long)ptr = x; stind.i8
    86 Stind_R4 Store Indirect, Float32 将32位浮点数存储到地址 (float)ptr = x; stind.r4
    87 Stind_R8 Store Indirect, Float64 将64位浮点数存储到地址 (double)ptr = x; stind.r8
    88 Add Add 将两个值相加 int z = x + y; ldloc.0
    ldloc.1
    add
    stloc.2
    89 Sub Subtract 将两个值相减 int z = x - y; ldloc.0
    ldloc.1
    sub
    stloc.2
    90 Mul Multiply 将两个值相乘 int z = x * y; ldloc.0
    ldloc.1
    mul
    stloc.2
    91 Div Divide 将两个值相除 int z = x / y; ldloc.0
    ldloc.1
    div
    stloc.2
    92 Div_Un Divide, Unsigned 将两个无符号值相除 uint z = x / y; ldloc.0
    ldloc.1
    div.un
    stloc.2
    93 Rem Remainder 计算两个值的余数 int z = x % y; ldloc.0
    ldloc.1
    rem
    stloc.2
    94 Rem_Un Remainder, Unsigned 计算两个无符号值的余数 uint z = x % y; ldloc.0
    ldloc.1
    rem.un
    stloc.2
    95 And And 计算两个值的按位与 int z = x & y; ldloc.0
    ldloc.1
    and
    stloc.2
    96 Or Or 计算两个值的按位或 int z = x | y; ldloc.0
    ldloc.1
    or
    stloc.2
    97 Xor Exclusive Or 计算两个值的按位异或 int z = x ^ y; ldloc.0
    ldloc.1
    xor
    stloc.2
    98 Shl Shift Left 将一个值左移指定的位数 int z = x << y; ldloc.0
    ldloc.1
    shl
    stloc.2
    99 Shr Shift Right 将一个值右移指定的位数 int z = x >> y; ldloc.0
    ldloc.1
    shr
    stloc.2
    100 Shr_Un Shift Right, Unsigned 将一个无符号值右移指定的位数 uint z = x >> y; ldloc.0
    ldloc.1
    shr.un
    stloc.2
    101 Neg Negate 取反操作 int z = -x; ldloc.0
    neg
    stloc.1
    102 Not Bitwise Not 按位取反操作 int z = ~x; ldloc.0
    not
    stloc.1
    103 Conv_I1 Convert to Int8 转换为8位整数 sbyte x = (sbyte)y; ldloc.0
    conv.i1
    stloc.1
    104 Conv_I2 Convert to Int16 转换为16位整数 short x = (short)y; ldloc.0
    conv.i2
    stloc.1
    105 Conv_I4 Convert to Int32 转换为32位整数 int x = (int)y; ldloc.0
    conv.i4
    stloc.1
    106 Conv_I8 Convert to Int64 转换为64位整数 long x = (long)y; ldloc.0
    conv.i8
    stloc.1
    107 Conv_R4 Convert to Float32 转换为32位浮点数 float x = (float)y; ldloc.0
    conv.r4
    stloc.1
    108 Conv_R8 Convert to Float64 转换为64位浮点数 double x = (double)y; ldloc.0
    conv.r8
    stloc.1
    109 Conv_U4 Convert to Unsigned Int32 转换为无符号32位整数 uint x = (uint)y; ldloc.0
    conv.u4
    stloc.1
    110 Conv_U8 Convert to Unsigned Int64 转换为无符号64位整数 ulong x = (ulong)y; ldloc.0
    conv.u8
    stloc.1
    111 Callvirt Call Virtual Method 调用虚方法 obj.Method(); ldloc.0
    callvirt instance void [mscorlib]System.Object::Method()
    112 Cpobj Copy Object 复制对象 *dest = *src; ldloc.0
    ldloc.1
    cpobj [mscorlib]System.Object
    113 Ldobj Load Object 加载对象 var x = *ptr; ldloc.0
    ldobj [mscorlib]System.Object
    114 Ldstr Load String 加载字符串 string s = "Hello"; ldstr "Hello"
    115 Newobj Create New Object 创建新对象 var obj = new MyClass(); newobj instance void MyClass::.ctor()
    116 Castclass Cast to Class 类型转换 var obj = (MyClass)other; ldloc.0
    castclass MyClass
    117 Isinst Is Instance 判断实例类型 var obj = other as MyClass; ldloc.0
    isinst MyClass
    118 Conv_R_Un Convert to Float, Unsigned 转换为无符号浮点数 double x = (double)y; ldloc.0
    conv.r.un
    stloc.1
    119 Unbox Unbox 拆箱操作 var obj = (MyClass)boxed; ldloc.0
    unbox MyClass
    120 Throw Throw Exception 抛出异常 throw ex; ldloc.0
    throw
    121 Ldfld Load Field 加载字段 var x = obj.field; ldloc.0
    ldfld int32 MyClass::field
    122 Ldflda Load Field Address 加载字段地址 var ptr = &obj.field; ldloc.0
    ldflda int32 MyClass::field
    123 Stfld Store Field 存储字段 obj.field = x; ldloc.0
    ldloc.1
    stfld int32 MyClass::field
    124 Ldsfld Load Static Field 加载静态字段 var x = MyClass.field; ldsfld int32 MyClass::field
    125 Ldsflda Load Static Field Address 加载静态字段地址 var ptr = &MyClass.field; ldsflda int32 MyClass::field
    126 Stsfld Store Static Field 存储静态字段 MyClass.field = x; ldloc.0
    stsfld int32 MyClass::field
    127 Stobj Store Object 存储对象 *ptr = obj; ldloc.0
    ldloc.1
    stobj [mscorlib]System.Object
    128 Conv_Ovf_I1_Un Convert to Int8, Unsigned, Overflow Check 转换为无符号8位整数,带溢出检查 sbyte x = checked((sbyte)y); ldloc.0
    conv.ovf.i1.un
    stloc.1
    129 Conv_Ovf_I2_Un Convert to Int16, Unsigned, Overflow Check 转换为无符号16位整数,带溢出检查 short x = checked((short)y); ldloc.0
    conv.ovf.i2.un
    stloc.1
    130 Conv_Ovf_I4_Un Convert to Int32, Unsigned, Overflow Check 转换为无符号32位整数,带溢出检查 int x = checked((int)y); ldloc.0
    conv.ovf.i4.un
    stloc.1
    131 Conv_Ovf_I8_Un Convert to Int64, Unsigned, Overflow Check 转换为无符号64位整数,带溢出检查 long x = checked((long)y); ldloc.0
    conv.ovf.i8.un
    stloc.1
    132 Conv_Ovf_U1_Un Convert to Unsigned Int8, Unsigned, Overflow Check 转换为无符号8位整数,带溢出检查 byte x = checked((byte)y); ldloc.0
    conv.ovf.u1.un
    stloc.1
    133 Conv_Ovf_U2_Un Convert to Unsigned Int16, Unsigned, Overflow Check 转换为无符号16位整数,带溢出检查 ushort x = checked((ushort)y); ldloc.0
    conv.ovf.u2.un
    stloc.1
    134 Conv_Ovf_U4_Un Convert to Unsigned Int32, Unsigned, Overflow Check 转换为无符号32位整数,带溢出检查 uint x = checked((uint)y); ldloc.0
    conv.ovf.u4.un
    stloc.1
    135 Conv_Ovf_U8_Un Convert to Unsigned Int64, Unsigned, Overflow Check 转换为无符号64位整数,带溢出检查 ulong x = checked((ulong)y); ldloc.0
    conv.ovf.u8.un
    stloc.1
    136 Conv_Ovf_I_Un Convert to Int, Unsigned, Overflow Check 转换为无符号整数,带溢出检查 int x = checked((int)y); ldloc.0
    conv.ovf.i.un
    stloc.1
    137 Conv_Ovf_U_Un Convert to Unsigned Int, Unsigned, Overflow Check 转换为无符号整数,带溢出检查 uint x = checked((uint)y); ldloc.0
    conv.ovf.u.un
    stloc.1
    138 Box Box 装箱操作 object obj = x; ldloc.0
    box [mscorlib]System.Int32
    139 Newarr Create New Array 创建新数组 var arr = new int[10]; ldc.i4.s 10
    newarr [mscorlib]System.Int32
    140 Ldlen Load Array Length 加载数组长度 int len = arr.Length; ldloc.0
    ldlen
    141 Ldelema Load Element Address 加载元素地址 ref int elem = ref arr[0]; ldloc.0
    ldc.i4.0
    ldelema [mscorlib]System.Int32
    142 Ldelem_I1 Load Element, Int8 加载8位整数元素 sbyte x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.i1
    143 Ldelem_U1 Load Element, Unsigned Int8 加载无符号8位整数元素 byte x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.u1
    144 Ldelem_I2 Load Element, Int16 加载16位整数元素 short x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.i2
    145 Ldelem_U2 Load Element, Unsigned Int16 加载无符号16位整数元素 ushort x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.u2
    146 Ldelem_I4 Load Element, Int32 加载32位整数元素 int x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.i4
    147 Ldelem_U4 Load Element, Unsigned Int32 加载无符号32位整数元素 uint x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.u4
    148 Ldelem_I8 Load Element, Int64 加载64位整数元素 long x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.i8
    149 Ldelem_I Load Element, Native Int 加载本机整数元素 IntPtr x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.i
    150 Ldelem_R4 Load Element, Float32 加载32位浮点数元素 float x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.r4
    151 Ldelem_R8 Load Element, Float64 加载64位浮点数元素 double x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.r8
    152 Ldelem_Ref Load Element, Reference 加载引用类型元素 object x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.ref
    153 Stelem_I Store Element, Native Int 存储本机整数元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.i
    154 Stelem_I1 Store Element, Int8 存储8位整数元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.i1
    155 Stelem_I2 Store Element, Int16 存储16位整数元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.i2
    156 Stelem_I4 Store Element, Int32 存储32位整数元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.i4
    157 Stelem_I8 Store Element, Int64 存储64位整数元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.i8
    158 Stelem_R4 Store Element, Float32 存储32位浮点数元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.r4
    159 Stelem_R8 Store Element, Float64 存储64位浮点数元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.r8
    160 Stelem_Ref Store Element, Reference 存储引用类型元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.ref
    161 Ldelem_Any Load Element, Any 加载任意类型元素 var x = arr[0]; ldloc.0
    ldc.i4.0
    ldelem.any [mscorlib]System.Object
    162 Stelem_Any Store Element, Any 存储任意类型元素 arr[0] = x; ldloc.0
    ldc.i4.0
    ldloc.1
    stelem.any [mscorlib]System.Object
    163 Unbox_Any Unbox Any 拆箱任意类型 var x = (MyClass)boxed; ldloc.0
    unbox.any MyClass
    164 Conv_Ovf_I1 Convert to Int8, Overflow Check 转换为8位整数,带溢出检查 sbyte x = checked((sbyte)y); ldloc.0
    conv.ovf.i1
    stloc.1
    165 Conv_Ovf_U1 Convert to Unsigned Int8, Overflow Check 转换为无符号8位整数,带溢出检查 byte x = checked((byte)y); ldloc.0
    conv.ovf.u1
    stloc.1
    166 Conv_Ovf_I2 Convert to Int16, Overflow Check 转换为16位整数,带溢出检查 short x = checked((short)y); ldloc.0
    conv.ovf.i2
    stloc.1
    167 Conv_Ovf_U2 Convert to Unsigned Int16, Overflow Check 转换为无符号16位整数,带溢出检查 ushort x = checked((ushort)y); ldloc.0
    conv.ovf.u2
    stloc.1
    168 Conv_Ovf_I4 Convert to Int32, Overflow Check 转换为32位整数,带溢出检查 int x = checked((int)y); ldloc.0
    conv.ovf.i4
    stloc.1
    169 Conv_Ovf_U4 Convert to Unsigned Int32, Overflow Check 转换为无符号32位整数,带溢出检查 uint x = checked((uint)y); ldloc.0
    conv.ovf.u4
    stloc.1
    170 Conv_Ovf_I8 Convert to Int64, Overflow Check 转换为64位整数,带溢出检查 long x = checked((long)y); ldloc.0
    conv.ovf.i8
    stloc.1
    171 Conv_Ovf_U8 Convert to Unsigned Int64, Overflow Check 转换为无符号64位整数,带溢出检查 ulong x = checked((ulong)y); ldloc.0
    conv.ovf.u8
    stloc.1
    172 Refanyval Reference Any Value 引用任意值 TypedReference tr = __makeref(obj); ldloc.0
    refanyval [mscorlib]System.Object
    173 Ckfinite Check Finite 检查有限性 if (float.IsNaN(x) || float.IsInfinity(x)) throw new ArithmeticException(); ldloc.0
    ckfinite
    174 Mkrefany Make Reference Any 创建任意引用 TypedReference tr = __makeref(obj); ldloc.0
    mkrefany [mscorlib]System.Object
    175 Ldtoken Load Token 加载标记 RuntimeTypeHandle handle = typeof(MyClass).TypeHandle; ldtoken MyClass
    176 Conv_U2 Convert to Unsigned Int16 转换为无符号16位整数 ushort x = (ushort)y; ldloc.0
    conv.u2
    stloc.1
    177 Conv_U1 Convert to Unsigned Int8 转换为无符号8位整数 byte x = (byte)y; ldloc.0
    conv.u1
    stloc.1
    178 Conv_I Convert to Int 转换为整数 IntPtr x = (IntPtr)y; ldloc.0
    conv.i
    stloc.1
    179 Conv_Ovf_I Convert to Int, Overflow Check 转换为整数,带溢出检查 int x = checked((int)y); ldloc.0
    conv.ovf.i
    stloc.1
    180 Conv_Ovf_U Convert to Unsigned Int, Overflow Check 转换为无符号整数,带溢出检查 uint x = checked((uint)y); ldloc.0
    conv.ovf.u
    stloc.1
    181 Add_Ovf Add, Overflow Check 加法,带溢出检查 int x = checked(a + b); ldloc.0
    ldloc.1
    add.ovf
    stloc.2
    182 Add_Ovf_Un Add Unsigned, Overflow Check 无符号加法,带溢出检查 uint x = checked(a + b); ldloc.0
    ldloc.1
    add.ovf.un
    stloc.2
    183 Mul_Ovf Multiply, Overflow Check 乘法,带溢出检查 int x = checked(a * b); ldloc.0
    ldloc.1
    mul.ovf
    stloc.2
    184 Mul_Ovf_Un Multiply Unsigned, Overflow Check 无符号乘法,带溢出检查 uint x = checked(a * b); ldloc.0
    ldloc.1
    mul.ovf.un
    stloc.2
    185 Sub_Ovf Subtract, Overflow Check 减法,带溢出检查 int x = checked(a - b); ldloc.0
    ldloc.1
    sub.ovf
    stloc.2
    186 Sub_Ovf_Un Subtract Unsigned, Overflow Check 无符号减法,带溢出检查 uint x = checked(a - b); ldloc.0
    ldloc.1
    sub.ovf.un
    stloc.2
    187 Endfinally End Finally 结束finally块 finally { ... } endfinally
    188 Leave Leave 离开 leave label; leave.s label
    189 Leave_S Leave Short 短离开 leave label; leave.s label
    190 Stind_I Store Indirect, Int 间接存储整数 *ptr = value; ldloc.0
    ldloc.1
    stind.i
    191 Conv_U Convert to Unsigned Int 转换为无符号整数 uint x = (uint)y; ldloc.0
    conv.u
    stloc.1
    192 Arglist Argument List 参数列表 RuntimeArgumentHandle args = __arglist(); arglist
    193 Ceq Compare Equal 比较相等 bool x = (a == b); ldloc.0
    ldloc.1
    ceq
    stloc.2
    194 Cgt Compare Greater Than 比较大于 bool x = (a > b); ldloc.0
    ldloc.1
    cgt
    stloc.2
    195 Cgt_Un Compare Greater Than Unsigned 比较无符号大于 bool x = (a > b); ldloc.0
    ldloc.1
    cgt.un
    stloc.2
    196 Clt Compare Less Than 比较小于 bool x = (a < b); ldloc.0
    ldloc.1
    clt
    stloc.2
    197 Clt_Un Compare Less Than Unsigned 比较无符号小于 bool x = (a < b); ldloc.0
    ldloc.1
    clt.un
    stloc.2
    198 Ldftn Load Function 加载函数 IntPtr ptr = obj.Method; ldftn instance void [mscorlib]System.Object::Method()
    199 Ldvirtftn Load Virtual Function 加载虚函数 IntPtr ptr = obj.Method; ldloc.0
    ldvirtftn instance void [mscorlib]System.Object::Method()
    200 Ldarg Load Argument 加载参数 int x = arg; ldarg.0
    201 Ldarga Load Argument Address 加载参数地址 ref int x = ref arg; ldarga.s 0
    202 Starg Store Argument 存储参数 arg = x; ldarg.0
    starg.s 0
    203 Ldloc Load Local 加载局部变量 int x = local; ldloc.0
    204 Ldloca Load Local Address 加载局部变量地址 ref int x = ref local; ldloca.s 0
    205 Stloc Store Local 存储局部变量 local = x; ldloc.0
    stloc.0
    206 Localloc Local Allocation 局部分配 byte* ptr = stackalloc byte[10]; ldc.i4.s 10
    localloc
    207 Endfilter End Filter 结束过滤器 endfilter; endfilter
    208 Unaligned Unaligned 未对齐 (unaligned int)ptr = value; unaligned. 1
    209 Volatile Volatile 易失 volatile int x = *ptr; volatile.
    210 Tail Tail 尾部 return Method(); tail.
    211 Initobj Initialize Object 初始化对象 obj = new MyClass(); ldloca.s obj
    initobj MyClass
    212 Constrained Constrained 约束 constrained. MyClass
    213 Cpblk Copy Block 复制块 Buffer.BlockCopy(src, 0, dest, 0, length); ldloc.0
    ldloc.1
    ldloc.2
    cpblk
    214 Initblk Initialize Block 初始化块 Unsafe.InitBlock(ptr, value, length); ldloc.0
    ldloc.1
    ldloc.2
    initblk
    215 No No Operation 无操作 #error directive no.
    216 Rethrow Rethrow 重新抛出 throw; rethrow
    217 Sizeof Size Of 大小 int size = sizeof(MyClass); sizeof MyClass
    218 Refanytype Reference Any Type 引用任意类型 Type t = __reftype(tr); ldloc.0
    refanytype
    219 Readonly Readonly 只读 readonly int x = *ptr; readonly.

    相关文章

      网友评论

        本文标题:IL Opcode 完整名称、中文释义及极简示例

        本文链接:https://www.haomeiwen.com/subject/hzoukjtx.html