• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Emit.OpCode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Reflection.Emit.OpCode的典型用法代码示例。如果您正苦于以下问题:C# OpCode类的具体用法?C# OpCode怎么用?C# OpCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OpCode类属于System.Reflection.Emit命名空间,在下文中一共展示了OpCode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IsTailableCall

 public static bool IsTailableCall(OpCode op)
 {
     return
         op == OpCodes.Call ||
         //op == OpCodes.Calli ||
         op == OpCodes.Callvirt;
 }
开发者ID:zhuozhuowang,项目名称:Sigil,代码行数:7,代码来源:ExtensionMethods.cs


示例2: Emit

 public void Emit(OpCode code, ConstructorInfo constructor)
 {
     if (code == OpCodes.Newobj)
     {
         instructions.Add((args) => EmitInternal(code, constructor));
     }
 }
开发者ID:vitamink,项目名称:LightInject,代码行数:7,代码来源:DynamicMethod.cs


示例3: EmitIf

 public void EmitIf(OpCode comparasionOpcode, bool not = false)
 {
     _generator
         .Emit(comparasionOpcode)
         .EmitIf(!not, a => a.Brfalse(_ifFalse))
         .EmitIf(not, a => a.Brtrue(_ifFalse));
 }
开发者ID:eknowledger,项目名称:FluentIL,代码行数:7,代码来源:IfEmitter.cs


示例4: Get

        public static int Get(OpCode op, Sigil.Label[] labels = null)
        {
            var baseSize = op.Size;
            int operandSize;

            switch (op.OperandType)
            {
                case OperandType.InlineBrTarget: operandSize = 4; break;
                case OperandType.InlineField: operandSize = 4; break;
                case OperandType.InlineI: operandSize = 4; break;
                case OperandType.InlineI8: operandSize = 8; break;
                case OperandType.InlineMethod: operandSize = 4; break;
                case OperandType.InlineNone: operandSize = 0; break;
                case OperandType.InlineR: operandSize = 8; break;
                case OperandType.InlineSig: operandSize = 4; break;
                case OperandType.InlineString: operandSize = 4; break;
                case OperandType.InlineSwitch: operandSize = 4 + labels.Length * 4; break;
                case OperandType.InlineTok: operandSize = 4; break;
                case OperandType.InlineType: operandSize = 4; break;
                case OperandType.InlineVar: operandSize = 2; break;
                case OperandType.ShortInlineBrTarget: operandSize = 1; break;
                case OperandType.ShortInlineI: operandSize = 1; break;
                case OperandType.ShortInlineR: operandSize = 4; break;
                case OperandType.ShortInlineVar: operandSize = 1; break;
                default: throw new Exception("Unexpected operand type [" + op.OperandType + "]");
            }

            return baseSize + operandSize;
        }
开发者ID:zhuozhuowang,项目名称:Sigil,代码行数:29,代码来源:InstructionSize.cs


示例5: OperatorToken

        internal OperatorToken(Operator op)
        {
            switch (op)
            {
                case Operator.Add:
                    _opCode = OpCodes.Add;
                    break;
                case Operator.Subtract:
                    _opCode = OpCodes.Sub;
                    break;
                case Operator.Multiply:
                    _opCode = OpCodes.Mul;
                    break;
                case Operator.Divide:
                    _opCode = OpCodes.Div;
                    break;
                case Operator.Power:
                    _opCode = OpCodes.Call;
                    break;
                case Operator.Modulus:
                    _opCode = OpCodes.Rem;
                    break;
                default:
                    throw new ArgumentException("Unknown operator.");
            }

            Operator = op;
        }
开发者ID:mgbowen,项目名称:graphing-calc-csharp,代码行数:28,代码来源:OperatorToken.cs


示例6: Instruction

 Instruction(ILReader reader, OpCode op, Operand arg, ushort label)
 {
     this.reader = reader;
     this.OpCode = op;
     this.Operand = arg;
     this.label = (ushort)label;
 }
开发者ID:naasking,项目名称:CIL,代码行数:7,代码来源:Instruction.cs


示例7: EmitIndexedInstruction

 private static void EmitIndexedInstruction(this ILGenerator il, OpCode[] index, int argument) {
     if (argument < index.Length - 1) {
         il.Emit(index[argument]);
         return;
     }
     il.Emit(index[index.Length - 1], argument);
 }
开发者ID:40a,项目名称:PowerShell,代码行数:7,代码来源:FluentIlExtensions.cs


示例8: MethodInstruction

 internal MethodInstruction(int offset, OpCode opCode, int token, ModuleScopeTokenResolver resolver)
 {
     this.offset = offset;
       this.opCode = opCode;
       this.resolver = resolver;
       this.token = token;
 }
开发者ID:mattlorimor,项目名称:AddInSpy,代码行数:7,代码来源:MethodInstruction.cs


示例9: GetOperandSize

        int GetOperandSize(OpCode o, int pos)
        {
            switch (o.OperandType)
            {
                case OperandType.ShortInlineBrTarget: return 1;
                case OperandType.ShortInlineI: return 1;
                case OperandType.ShortInlineR: return 4;
                case OperandType.ShortInlineVar: return 1;
                case OperandType.InlineVar: return 2;
                case OperandType.InlineType: return 4;
                case OperandType.InlineTok: return 4;
                case OperandType.InlineString: return 4;
                case OperandType.InlineSig: return 4;
                case OperandType.InlineR: return 8;
                case OperandType.InlineNone: return 0;
                case OperandType.InlineMethod: return 4;
                case OperandType.InlineI8: return 8;
                case OperandType.InlineI: return 4;
                case OperandType.InlineField: return 4;
                case OperandType.InlineBrTarget: return 4;
                case OperandType.InlineSwitch:
                    return 4 + 4 * BitConverter.ToInt32(code, pos);
            }

            throw new NotImplementedException();
        }
开发者ID:chrisforbes,项目名称:reflect_ilc,代码行数:26,代码来源:CilRecognizer.cs


示例10: AdvanceOffsetWithLabel

 private void AdvanceOffsetWithLabel(OpCode opcode) {
     AdvanceOffset(opcode);
     if (OpCodes.TakesSingleByteArgument(opcode)) {
         _offset++;
     } else {
         _offset += 4;
     }
 }
开发者ID:apboyle,项目名称:ironruby,代码行数:8,代码来源:OffsetTrackingILGenerator.cs


示例11: Emit

        public virtual void Emit(OpCode opcode, MethodInfo method)
        {
            _gen.Emit(opcode, method);

            var methodParameters = method.GetParameters();
            var parameters = string.Join(", ", methodParameters.Select(p => p.ParameterType.Name));
            _writer.WriteLine(string.Concat(opcode, ", ", method.Name, "(", parameters, ")"));
        }
开发者ID:jgshort,项目名称:CodeGen,代码行数:8,代码来源:DebugIlGenerator.cs


示例12: IsPrefix

 public static bool IsPrefix(OpCode op)
 {
     return
         op == OpCodes.Tailcall ||
         op == OpCodes.Readonly ||
         op == OpCodes.Volatile ||
         op == OpCodes.Unaligned;
 }
开发者ID:zhuozhuowang,项目名称:Sigil,代码行数:8,代码来源:ExtensionMethods.cs


示例13: BranchSet

 private BranchSet(OpCode brTrue, OpCode brFalse, OpCode brEq, OpCode brNe, OpCode brLt, OpCode brLtUn, OpCode brGt, OpCode brGtUn, OpCode brLe, OpCode brLeUn, OpCode brGe, OpCode brGeUn)
 {
     this.brTrue = brTrue; this.brFalse = brFalse;
     this.brEq = brEq; this.brNe = brNe;
     this.brLt = brLt; this.brLtUn = brLtUn;
     this.brGt = brGt; this.brGtUn = brGtUn;
     this.brLe = brLe; this.brLeUn = brLeUn;
     this.brGe = brGe; this.brGeUn = brGeUn;
 }
开发者ID:jimmmeh,项目名称:runsharp,代码行数:9,代码来源:BranchSet.cs


示例14: ConditionExpression

		public ConditionExpression( OpCode operation, Expression left, Expression right )
		{
			_trueStmts = new ArrayList();
			_falseStmts = new ArrayList();

			_operation = operation;
			_left = left;
			_right = right;
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:9,代码来源:ConditionExpression.cs


示例15: CheckAndEmit

        protected void CheckAndEmit(OpCode? argument)
        {
            if(!argument.HasValue)
            {
                throw new InvalidOperationException();
            }

            generator.Emit(argument.Value);
        }
开发者ID:antmicro,项目名称:Migrant,代码行数:9,代码来源:GenerationContextBase.cs


示例16: EmitCall

        public void EmitCall(OpCode opCode, MethodInfo mi)
        {
            ProcessCommand(
                opCode, 
                (mi.GetParameters().Length + 1) * -1 + (mi.ReturnType == typeof(void) ? 0 : 1), 
                mi.ToString()
                );

            ilGenerator.EmitCall(opCode, mi, null);
        }
开发者ID:antonovicha,项目名称:EmitMapperRedux,代码行数:10,代码来源:CompilationContext.cs


示例17: Emit

		public DynamicMethodBody Emit(OpCode opcode)
		{
			ExecutePreEmitActions();
	#if DEBUG
			Console.WriteLine(string.Format("\t{0}", opcode));
	#endif
			Emitter.Emit(opcode);

			return this;
		}
开发者ID:mwoelk83,项目名称:FluentIL,代码行数:10,代码来源:DynamicMethodBody.Emit.cs


示例18: EmitInternal

 internal void EmitInternal(OpCode code, ConstructorInfo constructor)
 {
     if (code == OpCodes.Newobj)
     {
         var parameterCount = constructor.GetParameters().Length;
         object[] arguments = Pop(parameterCount);
         Type type = constructor.DeclaringType;
         object instance = Activator.CreateInstance(type, arguments);
         stack.Push(instance);
     }
 }
开发者ID:vitamink,项目名称:LightInject,代码行数:11,代码来源:DynamicMethod.cs


示例19: OpCodeKb

        private OpCodeKb(OpCodeFamilyKb familyKb, OpCode? opcode)
        {
            FamilyKb = familyKb;
            _opCode = opcode;

            Tags = new HashSet<String>();
            Meta = new Dictionary<String, String>();
            Fields = new Dictionary<String, FieldSpec>();
            Props = new Dictionary<String, PropertySpec>();
            Prefixes = new Dictionary<String, PrefixSpec>();
        }
开发者ID:xeno-by,项目名称:truesight-lite,代码行数:11,代码来源:OpCodeKb.cs


示例20: Emit

		public DynamicMethodBody Emit(OpCode opcode, TypeReference arg)
		{
			ExecutePreEmitActions();
#if DEBUG
			Console.WriteLine("\t{0} {1}", opcode, arg);
#endif

			Emitter.Emit(opcode, arg);

			return this;
		}
开发者ID:mwoelk83,项目名称:FluentIL,代码行数:11,代码来源:DynamicMethodBody.Emit.Cecil.cs



注:本文中的System.Reflection.Emit.OpCode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Emit.PropertyBuilder类代码示例发布时间:2022-05-26
下一篇:
C# Emit.ModuleBuilder类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap