当前位置: 首页>>代码示例>>C#>>正文


C# Emit.OpCode类代码示例

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


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


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