case Opcodes.ICONST_M1: case Opcodes.ICONST_0: case Opcodes.ICONST_1: case Opcodes.ICONST...: case Opcodes.FADD: case Opcodes.ISUB: case Opcodes.FSUB: case Opcodes.IMUL...: case Opcodes.FMUL: case Opcodes.IDIV: case Opcodes.FDIV: case Opcodes.IREM...: case Opcodes.DSUB: case Opcodes.LMUL: case Opcodes.DMUL: case Opcodes.LDIV...: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT
, 1)); il.add(new InsnNode(Opcodes.ICONST_1)); LabelNode label = new LabelNode();...// if (espresso > 0) 跳转通过LabelNode标记跳转地址 il.add(new JumpInsnNode(Opcodes.IF_ICMPLE, label...)); il.add(new VarInsnNode(Opcodes.ALOAD, 0)); il.add(new VarInsnNode(Opcodes.ILOAD...)); il.add(new InsnNode(Opcodes.ATHROW)); il.add(end); // stack map 的第二次偏移记录...il.add(new FrameNode(Opcodes.F_SAME, 0, null, 0, null)); il.add(new InsnNode(Opcodes.RETURN
(OpCodes.Stfld, fieldBeProxy); ilOfCtor.Emit(OpCodes.Ret); // ---- 定义类中的方法 -...(OpCodes.Ldarg, j + 1); ilOfMethod.Emit(OpCodes.Stelem_Ref);...} ilOfMethod.Emit(OpCodes.Ldarg_0); ilOfMethod.Emit(OpCodes.Ldfld...ilOfMethod.Emit(OpCodes.Ldstr, method.Name); ilOfMethod.Emit(OpCodes.Ldloc, parameters..._0);传入this,即子类本身,如果是实现接口方法,通过 ilOfMethod.Emit(OpCodes.Ldarg_0);ilOfMethod.Emit(OpCodes.Ldfld, fieldBeProxy
ctor1IL.Emit(OpCodes.Ldarg_0); ctor1IL.Emit(OpCodes.Call, typeof(object).GetConstructor(Type.EmptyTypes...ctor1IL.Emit(OpCodes.Ldarg_0); ctor1IL.Emit(OpCodes.Ldarg_1); ctor1IL.Emit(OpCodes.Stfld..., "欢迎来到高级班第15期进阶学习"); consoleMethodIL.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine..._0); AddMethodIL.Emit(OpCodes.Ldarg_1); AddMethodIL.Emit(OpCodes.Add_Ovf_Un);...AddMethodIL.Emit(OpCodes.Ret);
: case Opcodes.LRETURN: case Opcodes.FRETURN: case Opcodes.DRETURN:...: return 0; case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT...: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IFNULL...case Opcodes.LRETURN: case Opcodes.FRETURN: case Opcodes.DRETURN:...case Opcodes.ARETURN: case Opcodes.RETURN: case Opcodes.ATHROW: successor
OpCodes.Box, typeof(int));//将int类型转为引用类型并且推送到计算机堆栈 ilMethod.Emit(OpCodes.Ret);//返回栈顶结果...il.Emit(OpCodes.Ldstr, "参数是没问题的"); il.Emit(OpCodes.Call, methods);//调用方法...il.Emit(OpCodes.Ldstr, "参数是false,或者0,或者空引用"); il.Emit(OpCodes.Call, methods);//调用方法...);// setMhIl.Emit(OpCodes.Ldarg_0);//加载自变量 setMhIl.Emit(OpCodes.Ldarg...(OpCodes.Ldstr, "Hello World!")
ilMethod.Emit(OpCodes.Add);//将第一个和第二个参数相加, ilMethod.Emit(OpCodes.Stloc_0);//结果赋值给第0个本地变量...ilMethod.Emit(OpCodes.Ldloc_0);//加载倒栈中 ilMethod.EmitCall(OpCodes.Call...ilMethod.Emit(OpCodes.And);//将第一个和第二个参数相加, ilMethod.Emit(OpCodes.Stloc_0);//将And结果 赋值给..."); ilMethod.Emit(OpCodes.Call, method); ilMethod.Emit(OpCodes.Ret);..."); ilMethod.Emit(OpCodes.Call, method); ilMethod.Emit(OpCodes.Ret);
(OpCodes.Stfld, fieldBeProxy); ilOfCtor.Emit(OpCodes.Ret); #endregion...(OpCodes.Ldarg, j + 1); ilOfMethod.Emit(OpCodes.Stelem_Ref);...} ilOfMethod.Emit(OpCodes.Ldarg_0); ilOfMethod.Emit(OpCodes.Ldfld...ilOfMethod.Emit(OpCodes.Ldstr, method.Name); ilOfMethod.Emit(OpCodes.Ldloc, parameters...(OpCodes.Ldloc, localend); ilOfMethod.Emit(OpCodes.Callvirt, InterceptType.GetMethod
) { mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io...(Opcodes.ALOAD, 1); mv.visitVarInsn(Opcodes.ALOAD, 2); mv.visitMethodInsn...| Opcodes.ACC_PROTECTED)) !...| Opcodes.ACC_PROTECTED)) !..., 0); setNameVisitor.visitVarInsn(Opcodes.ALOAD, 1); setNameVisitor.visitFieldInsn(Opcodes.PUTFIELD
// C#: result = default(T); il.Emit(OpCodes.Ldloca_S, (byte)0); il.Emit(OpCodes.Initobj...// C#: result = new T(); il.Emit(OpCodes.Newobj, constructorInfo); il.Emit(OpCodes.Stloc...); il.Emit(OpCodes.Call, DeepCopier.MethodInfos.GetTypeFromHandle); il.Emit(OpCodes.Call...使用 OpCodes.Call 来调用 CopyContext.RecordObject 方法,因为 CopyContext 是一个 sealed 类,否则会使用 OpCodes.Callvirt 。...il.Emit(OpCodes.Ldloca_S, (byte)0); } else { il.Emit(OpCodes.Ldloc
this.GetType()); ILGenerator il = dynamicMethod.GetILGenerator(); il.Emit(OpCodes.Nop...); il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldarg_2); il.Emit(OpCodes.Ldarg..._1); il.Emit(OpCodes.Call, tempHandlerMethodInfo); il.Emit(OpCodes.Nop);...il.Emit(OpCodes.Ret); dynamicMethod.DefineParameter(1, ParameterAttributes.In, "object")
_1); EmitFastInt(il, i); il.Emit(OpCodes.Ldelem_Ref); ...EmitCastToReference(il, paramTypes[i]); il.Emit(OpCodes.Stloc, locals[i]); ..., locals[i]); else il.Emit(OpCodes.Ldloc, locals[i]); ...if (locals[i].LocalType.IsValueType) il.Emit(OpCodes.Box, locals[i].LocalType...(OpCodes.Ldc_I4_7); return; case: il.Emit(OpCodes.Ldc_I4
_0); ctor1IL.Emit(OpCodes.Call, typeof(object).GetConstructor(Type.EmptyTypes)); ctor1IL.Emit(OpCodes.Ldarg..._0); ctor1IL.Emit(OpCodes.Ldarg_1); ctor1IL.Emit(OpCodes.Stfld, fbNumber); ctor1IL.Emit(OpCodes.Ret);..._0); ctor0IL.Emit(OpCodes.Ldc_I4_S, 42); ctor0IL.Emit(OpCodes.Call, ctor1); ctor0IL.Emit(OpCodes.Ret)..._0); numberSetIL.Emit(OpCodes.Ldarg_1); numberSetIL.Emit(OpCodes.Stfld, fbNumber); numberSetIL.Emit(OpCodes.Ret..._0); methIL.Emit(OpCodes.Ldfld, fbNumber); methIL.Emit(OpCodes.Ldarg_1); methIL.Emit(OpCodes.Mul); methIL.Emit
generator.Emit(OpCodes.Ldc_I4, 234); 60 generator.Emit(OpCodes.Stloc_1); 61 62...(OpCodes.Ldloc_1); 65 generator.Emit(OpCodes.Add); 66 generator.Emit(OpCodes.Stloc...; //和上面代码 同意思 87 88 //generator.Emit(OpCodes.Pop); //是否是 无返回值函数 调用之后,不用弹出堆栈?..._0); 63 generator.Emit(OpCodes.Ldfld, fieldInfo); 64 generator.Emit(OpCodes.Stloc...//和上面代码 同意思 73 74 //generator.Emit(OpCodes.Pop); //是否是 无返回值函数 调用之后,不用弹出堆栈?
ilMethod.Emit(OpCodes.Stloc, localBegin);//给循环的开始值begin赋值0 ilMethod.Emit(OpCodes.Ldarg_0)...(OpCodes.Stloc, localEnd);//给结束变量赋值为集合的count ilMethod.Emit(OpCodes.Br, labelXunhuan);//无条件跳转到循环的...ilMethod.Emit(OpCodes.Bge, labelEnd);//比较第0个是否小于等于第一个 //ilMethod.Emit(OpCodes.Call, typeof...ilMethod.Emit(OpCodes.Ldloc, localBegin);//加载循环的开始变量 ilMethod.Emit(OpCodes.Callvirt...(OpCodes.Ldloc, localEx);//加载ex变量 ilMethod.Emit(OpCodes.Callvirt, str);//调用tostring()
_0); il.Emit(OpCodes.Ldarg_1); il.Emit(OpCodes.Stfld, targetField); il.Emit(OpCodes.Ret..._1); il.Emit(OpCodes.Call, typeof(Indicator).GetProperty("Injected").SetMethod); il.Emit...(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldfld, targetField); il.Emit(OpCodes.Callvirt, typeof...(IFoobar).GetMethod("Invoke")); il.Emit(OpCodes.Ret); return typeBuilder.CreateType()...(OpCodes.Ldarg_0); il.Emit(OpCodes.Call, typeof(Foobar).GetMethod("Invoke")); il.Emit
: break; case Opcodes.ACONST_NULL: case Opcodes.ICONST_M1: case Opcodes.ICONST..._0: case Opcodes.ICONST_1: case Opcodes.ICONST_2: case Opcodes.ICONST_3:...case Opcodes.ICONST_4: case Opcodes.ICONST_5: case Opcodes.FCONST_0: case Opcodes.FCONST..._0: case Opcodes.LCONST_1: case Opcodes.DCONST_0: case Opcodes.DCONST_1:...case Opcodes.FALOAD: case Opcodes.AALOAD: case Opcodes.BALOAD: case
_1);// los generator.Emit(OpCodes.Ldarg_0);// s generator.Emit(OpCodes.Callvirt..._1);// los generator.Emit(OpCodes.Ldarg_0);// s generator.Emit(OpCodes.Callvirt...generator.Emit(OpCodes.Ret); var clone = (Action) dynamicMethod.CreateDelegate(typeof..._1);// los generator.Emit(OpCodes.Ldarg_0);// s generator.Emit(OpCodes.Callvirt...(currently 1 item on eval stack) generator.Emit(OpCodes.Ldloc_0); //
; il.Emit(OpCodes.Call, typeof(Console).GetMethod("WriteLine", new Type[] { typeof(string) })); il.Emit...(OpCodes.Call, typeof(Console).GetMethod("ReadLine")); il.Emit(OpCodes.Pop); // we just read something...here, throw it. il.Emit(OpCodes.Ret); 创建类型, // then create the whole class type var helloKittyClassType...(string) })); il.Emit(OpCodes.Call, typeof(Console).GetMethod("ReadLine")); il.Emit...(OpCodes.Pop); // we just read something here, throw it.
领取专属 10元无门槛券
手把手带您无忧上云