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

C# OpCode类代码示例

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

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



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

示例1: BinaryOperation

 public BinaryOperation(string sOp, Expression x, Expression y)
 {
     operation = sOp;
     opcode = StringToOpCode(sOp);
     operand1 = x;
     operand2 = y;
 }
开发者ID:catb0t,项目名称:heron-language,代码行数:7,代码来源:HeronBinaryOperation.cs


示例2: Packet

 protected Packet( OpCode opCode )
 {
     if( !Enum.IsDefined( typeof( OpCode ), OpCode ) ) {
         throw new ArgumentOutOfRangeException( "opCode" );
     }
     OpCode = opCode;
 }
开发者ID:fragmer,项目名称:fBot,代码行数:7,代码来源:Packet.cs


示例3: OpCodes

        //wicky.patch.start
        static OpCodes()
        {
            //Start from first index to ignore nop (onebyte)
            for (int i = 1; i < OneByteOpCode.Length; i++)
            {
                //arglist: FE 00
                if (OneByteOpCode[i].Op2 == 0x00 && OneByteOpCode[i].Code != Code.Arglist)
                {
                    OneByteOpCode[i] = new OpCode(
                        0xff << 0 | (byte)i << 8 | (byte)Code.Unused << 16 | (byte)FlowControl.Next << 24,
                        (byte)OpCodeType.Primitive << 0 | (byte)OperandType.InlineNone << 8 | (byte)StackBehaviour.Pop0 << 16 | (byte)StackBehaviour.Push0 << 24);
                }
            }

            //Start from first index to ignore arglist (twobyte)
            for (int i = 1; i < TwoBytesOpCode.Length; i++)
            {
                //arglist: FE 00
                if (TwoBytesOpCode[i].Op2 == 0x00 && TwoBytesOpCode[i].Code != Code.Arglist)
                {
                    TwoBytesOpCode[i] = new OpCode(
                    0xfe << 0 | (byte)i << 8 | (byte)Code.Unused << 16 | (byte)FlowControl.Next << 24,
                    (byte)OpCodeType.Primitive << 0 | (byte)OperandType.InlineNone << 8 | (byte)StackBehaviour.Pop0 << 16 | (byte)StackBehaviour.Push0 << 24);
                }
            }

        }
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:28,代码来源:OpCodes.cs


示例4: AddCodes

        public static void AddCodes(NodeBase caller, BlockBase parent, NodeBase target, OpModule codes, string op, Addr32 dest)
        {
            if (target is TypeOf) target = (target as TypeOf).Target;

            var v = target as Variant;
            if (v != null && parent.GetFunction(v.Name) == null)
            {
                var fpname = (target as Variant).Name;
                var fpt = Types.GetType(parent, fpname);
                if (fpt == null || !fpt.Check())
                    throw caller.Abort("undefined type: {0}", fpname);
                codes.AddCodesV(op, dest, codes.GetTypeObject(fpt));
                return;
            }

            var tt = target.Type;
            var tr = tt as TypeReference;
            var tts = tt.Type as TypeStruct;
            if (tr != null && (tr.IsArray || (tts != null && tts.IsClass)))
            {
                target.AddCodesV(codes, "mov", null);
                var label = new OpCode();
                codes.Add(I386.Test(Reg32.EAX, Reg32.EAX));
                codes.Add(I386.Jcc(Cc.Z, label.Address));
                codes.Add(I386.MovRA(Reg32.EAX, Addr32.NewRO(Reg32.EAX, -16)));
                codes.Add(label);
                codes.AddCodes(op, dest);
            }
            else
                codes.AddCodesV(op, dest, codes.GetTypeObject(tt));
        }
开发者ID:7shi,项目名称:LLPML,代码行数:31,代码来源:TypeOf.cs


示例5: WriteCodes

 public static void WriteCodes(BinaryWriter bw, OpCode[] ops)
 {
     for (int i = 0; i < ops.Length; i++)
     {
         bw.Write(ops[i].GetCodes());
     }
 }
开发者ID:7shi,项目名称:LLPML,代码行数:7,代码来源:Module.cs


示例6: Emit_UnknownOpCode_ThrowsNotSupportedException

        public void Emit_UnknownOpCode_ThrowsNotSupportedException()
        {
            var ilGenerator = new ILGenerator(null);
            var opCode = new OpCode(-1);

            ExceptionAssert.Throws<NotSupportedException>(() => ilGenerator.Emit(opCode));
        }
开发者ID:hendryten,项目名称:LightInject,代码行数:7,代码来源:OpCodeTests.cs


示例7: IsCall

 static bool IsCall(OpCode opCode)
 {
     return opCode == OpCodes.Call ||
            opCode == OpCodes.Callvirt ||
            opCode == OpCodes.Calli ||
            opCode == OpCodes.Ldftn;
 }
开发者ID:chantsunman,项目名称:PropertyChanged,代码行数:7,代码来源:RecursiveIlFinder.cs


示例8: StobjInstruction

 /// <summary>
 /// Initializes a new instance of the <see cref="StobjInstruction"/> class.
 /// </summary>
 /// <param name="opcode">The opcode.</param>
 public StobjInstruction(OpCode opcode)
     : base(opcode)
 {
     switch (opcode) {
         case OpCode.Stind_i1:
             _valueType = new SigType(CilElementType.I1);
             break;
         case OpCode.Stind_i2:
             _valueType = new SigType(CilElementType.I2);
             break;
         case OpCode.Stind_i4:
             _valueType = new SigType(CilElementType.I4);
             break;
         case OpCode.Stind_i8:
             _valueType = new SigType(CilElementType.I8);
             break;
         case OpCode.Stind_r4:
             _valueType = new SigType(CilElementType.R4);
             break;
         case OpCode.Stind_r8:
             _valueType = new SigType(CilElementType.R8);
             break;
         case OpCode.Stind_i:
             _valueType = new SigType(CilElementType.I);
             break;
         case OpCode.Stind_ref: // FIXME: Really object?
             _valueType = new SigType(CilElementType.Object);
             break;
         default:
             throw new NotImplementedException();
     }
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:36,代码来源:StobjInstruction.cs


示例9: CompiledByte

 public CompiledByte(OpCode op, Value a, Value b)
 {
     ushort[] output = compile(op,a,b);
     for (int i = 0; i < output.Length; i++)
     {
         ;
     }
 }
开发者ID:Tipaa,项目名称:DCPU-ASM-IDE,代码行数:8,代码来源:MachineCode.cs


示例10: AssertOpCodeSequence

        static void AssertOpCodeSequence(OpCode [] expected, MethodBody body)
        {
            var opcodes = body.Instructions.Select (i => i.OpCode).ToArray ();
            Assert.AreEqual (expected.Length, opcodes.Length);

            for (int i = 0; i < opcodes.Length; i++)
                Assert.AreEqual (expected [i], opcodes [i]);
        }
开发者ID:ttRevan,项目名称:cecil,代码行数:8,代码来源:ILProcessorTests.cs


示例11: AddJumpBack

        private void AddJumpBack(OpCode jumpOp, string jumpLabel)
        {
            // pop the most recently-added jump with the label
            JumpPatch jump = mJumpBackPatches.Last(j => j.Label == jumpLabel);
            mJumpBackPatches.Remove(jump);

            mBytecode.Write(jumpOp, jump.Location);
        }
开发者ID:rwaldron,项目名称:magpie,代码行数:8,代码来源:JumpTable.cs


示例12: Instruction

 public Instruction(byte[] code, int offset, int length, OpCode oc, TokenResolver resolver)
 {
     this.code = code;
     this.offset = offset;
     this.length = length;
     this.oc = oc;
     this.resolver = resolver;
 }
开发者ID:chrisforbes,项目名称:reflect_ilc,代码行数:8,代码来源:Instruction.cs


示例13: Add

		public void Add(Token token, OpCode op, string stringValue, params int[] args)
		{
			List<int> nums = new List<int>(args);
			nums.Insert(0, (int)op);
			this.byteCode.Add(nums.ToArray());
			this.tokens.Add(token);
			this.stringArgs.Add(stringValue);
		}
开发者ID:geofrey,项目名称:crayon,代码行数:8,代码来源:ByteBuffer.cs


示例14: AddJump

        private void AddJump(OpCode jumpOp, string jumpLabel)
        {
            // add the jump and a blank space for the destination
            mBytecode.Write(jumpOp, 0);

            // patch the destination later
            mJumpPatches.Add(new JumpPatch(jumpLabel, mBytecode.Position - 4));
        }
开发者ID:rwaldron,项目名称:magpie,代码行数:8,代码来源:JumpTable.cs


示例15: Instruction

        public Instruction(OpCode opcode, int index, params Operand[] operands)
        {
            OpCode = opcode;

            Operands = operands;

            Index = index;
        }
开发者ID:jnsergio,项目名称:NPortugol,代码行数:8,代码来源:Instruction.cs


示例16: ScriptElement

 public ScriptElement(OpCode opCode, Byte[] data = null)
 {
     this.opCode = opCode;
     this.data = data;
     if (opCode == OpCode.OP_0)
         this.data = new ScriptVarInt(0).ToBytes();
     else if (opCode == OpCode.OP_1NEGATE || (OpCode.OP_1 <= opCode && opCode <= OpCode.OP_16))
         this.data = new ScriptVarInt((int)opCode - ((int)OpCode.OP_1 - 1)).ToBytes();
 }
开发者ID:bbqchickenrobot,项目名称:Bitcoin-Tool,代码行数:9,代码来源:ScriptElement.cs


示例17: AddBinaryOperator

        /// <summary>
        ///     Adds a binary operator.
        /// </summary>
        /// <param name="operator">The operator's operation code.</param>
        /// <param name="supportedTypes">The supported types on both sides of the operator.</param>
        /// <param name="func">The logic to perform this operator.</param>
        /// <param name="order">The order the left/right values may appear in.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if <see cref="supportedTypes" /> or <see cref="func" /> is null.</exception>
        public void AddBinaryOperator(OpCode @operator, Type[] supportedTypes,
            Func<EarleValue, EarleValue, EarleValue> func,
            EarleOperatorParamOrder order = EarleOperatorParamOrder.Normal)
        {
            if (supportedTypes == null) throw new ArgumentNullException(nameof(supportedTypes));
            if (func == null) throw new ArgumentNullException(nameof(func));

            AddBinaryOperator(@operator, supportedTypes, supportedTypes, func, order);
        }
开发者ID:ikkentim,项目名称:earlescript,代码行数:17,代码来源:EarleOperatorCollection.cs


示例18: LdobjInstruction

        /// <summary>
        /// Initializes a new instance of the <see cref="LdobjInstruction"/> class.
        /// </summary>
        /// <param name="opcode">The opcode.</param>
        public LdobjInstruction(OpCode opcode)
            : base(opcode, 1)
        {
            switch (opcode)
            {
                case OpCode.Ldind_i1:
                    typeRef = BuiltInSigType.SByte;
                    break;

                case OpCode.Ldind_i2:
                    typeRef = BuiltInSigType.Int16;
                    break;

                case OpCode.Ldind_i4:
                    typeRef = BuiltInSigType.Int32;
                    break;

                case OpCode.Ldind_i8:
                    typeRef = BuiltInSigType.Int64;
                    break;

                case OpCode.Ldind_u1:
                    typeRef = BuiltInSigType.Byte;
                    break;

                case OpCode.Ldind_u2:
                    typeRef = BuiltInSigType.UInt16;
                    break;

                case OpCode.Ldind_u4:
                    typeRef = BuiltInSigType.UInt32;
                    break;

                case OpCode.Ldind_i:
                    typeRef = BuiltInSigType.IntPtr;
                    break;

                case OpCode.Ldind_r4:
                    typeRef = BuiltInSigType.Single;
                    break;

                case OpCode.Ldind_r8:
                    typeRef = BuiltInSigType.Double;
                    break;

                case OpCode.Ldind_ref: // FIXME: Really object?
                    typeRef = BuiltInSigType.Object;
                    break;

                case OpCode.Ldobj: // FIXME
                    typeRef = null; // BuiltInSigType.Object;
                    break;

                default:
                    throw new NotImplementedException();
            }
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:61,代码来源:LdobjInstruction.cs


示例19: Emit

		internal void Emit(ILGenerator ilgen, OpCode opcode)
		{
			if (local == null)
			{
				// it's a temporary local that is only allocated on-demand
				local = ilgen.DeclareLocal(type);
			}
			ilgen.Emit(opcode, local);
		}
开发者ID:Semogj,项目名称:ikvm-fork,代码行数:9,代码来源:CodeEmitter.cs


示例20: 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)
		{
			BrTrue = brTrue; BrFalse = brFalse;
			BrEq = brEq; BrNe = brNe;
			BrLt = brLt; BrLtUn = brLtUn;
			BrGt = brGt; BrGtUn = brGtUn;
			BrLe = brLe; BrLeUn = brLeUn;
			BrGe = brGe; BrGeUn = brGeUn;
		}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:9,代码来源:BranchSet.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# OpCodeType类代码示例发布时间:2022-05-24
下一篇:
C# Op类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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