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


C# IInstructionDecoder.DecodeUShort方法代码示例

本文整理汇总了C#中IInstructionDecoder.DecodeUShort方法的典型用法代码示例。如果您正苦于以下问题:C# IInstructionDecoder.DecodeUShort方法的具体用法?C# IInstructionDecoder.DecodeUShort怎么用?C# IInstructionDecoder.DecodeUShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInstructionDecoder的用法示例。


在下文中一共展示了IInstructionDecoder.DecodeUShort方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Decode

        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            // Decode the base first
            base.Decode(ctx, decoder);

            ushort argIdx;

            // Opcode specific handling
            if (opcode == OpCode.Starg_s)
            {
                byte arg = decoder.DecodeByte();
                argIdx = arg;
            }
            else
            {
                argIdx = decoder.DecodeUShort();
            }

            // The argument is the result
            ctx.Result = decoder.Compiler.GetParameterOperand(argIdx);

            // FIXME: Do some type compatibility checks
            // See verification for this instruction and
            // verification types.
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:30,代码来源:StargInstruction.cs

示例2: Decode

        /// <summary>
        /// Decodes the specified CIL instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        /// <remarks>
        /// This method is used by instructions to retrieve immediate operands
        /// From the instruction stream.
        /// </remarks>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            // Decode base classes first
            base.Decode(ctx, decoder);

            ushort argIdx;

            // Opcode specific handling
            switch (opcode)
            {
                case OpCode.Ldarg:
                    argIdx = decoder.DecodeUShort();
                    break;

                case OpCode.Ldarg_s:
                    argIdx = decoder.DecodeByte();
                    break;

                case OpCode.Ldarg_0:
                    argIdx = 0;
                    break;

                case OpCode.Ldarg_1:
                    argIdx = 1;
                    break;

                case OpCode.Ldarg_2:
                    argIdx = 2;
                    break;

                case OpCode.Ldarg_3:
                    argIdx = 3;
                    break;

                default:
                    throw new System.NotImplementedException();
            }

            // Push the loaded value onto the evaluation stack
            Operand parameterOperand = decoder.Compiler.GetParameterOperand(argIdx);
            Operand result = LoadInstruction.CreateResultOperand(decoder, parameterOperand.StackType, parameterOperand.Type);

            ctx.Operand1 = parameterOperand;
            ctx.Result = result;
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:54,代码来源:LdargInstruction.cs

示例3: Decode

        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            // Decode base classes first
            base.Decode(ctx, decoder);

            // Opcode specific handling
            ushort locIdx;
            switch (opcode)
            {
                case OpCode.Ldloc:
                    locIdx = decoder.DecodeUShort();
                    break;

                case OpCode.Ldloc_s:
                    locIdx = decoder.DecodeByte();
                    break;

                case OpCode.Ldloc_0:
                    locIdx = 0;
                    break;

                case OpCode.Ldloc_1:
                    locIdx = 1;
                    break;

                case OpCode.Ldloc_2:
                    locIdx = 2;
                    break;

                case OpCode.Ldloc_3:
                    locIdx = 3;
                    break;

                default:
                    throw new System.NotImplementedException();
            }

            // Push the loaded value onto the evaluation stack
            Operand localVariableOperand = decoder.Compiler.GetLocalOperand(locIdx);
            Operand result = LoadInstruction.CreateResultOperand(decoder, localVariableOperand.StackType, localVariableOperand.Type);

            ctx.Operand1 = localVariableOperand;
            ctx.Result = result;
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:49,代码来源:LdlocInstruction.cs

示例4: Decode

        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            // Decode base classes first
            base.Decode(ctx, decoder);

            ushort locIdx;

            // Destination depends on the opcode
            switch (opcode)
            {
                case OpCode.Stloc:
                    locIdx = decoder.DecodeUShort();
                    break;

                case OpCode.Stloc_s:
                    {
                        byte loc = decoder.DecodeByte();
                        locIdx = loc;
                        break;
                    }

                case OpCode.Stloc_0:
                    locIdx = 0;
                    break;

                case OpCode.Stloc_1:
                    locIdx = 1;
                    break;

                case OpCode.Stloc_2:
                    locIdx = 2;
                    break;

                case OpCode.Stloc_3:
                    locIdx = 3;
                    break;

                default:
                    throw new NotImplementedException();
            }

            ctx.Result = decoder.Compiler.GetLocalOperand(locIdx);
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:48,代码来源:StlocInstruction.cs

示例5: Decode

        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            // Decode base classes first
            base.Decode(ctx, decoder);

            ushort argIdx;

            // Opcode specific handling
            if (opcode == OpCode.Ldarga_s)
            {
                argIdx = decoder.DecodeByte();
            }
            else
            {
                argIdx = decoder.DecodeUShort();
            }

            Operand parameterOperand = decoder.Compiler.GetParameterOperand(argIdx);
            ctx.Operand1 = parameterOperand;
            ctx.Result = decoder.Compiler.CreateTemporary(new RefSigType(parameterOperand.Type));
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:26,代码来源:LdargaInstruction.cs

示例6: Decode

        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            // Decode base classes first
            base.Decode(ctx, decoder);

            ushort locIdx;

            // Opcode specific handling
            if (opcode == OpCode.Ldloca_s)
            {
                byte loc = decoder.DecodeByte();
                locIdx = loc;
            }
            else
            {
                locIdx = decoder.DecodeUShort();
            }

            Operand localVariableOperand = decoder.Compiler.GetLocalOperand(locIdx);
            ctx.Operand1 = localVariableOperand;
            ctx.Result = decoder.Compiler.CreateTemporary(new RefSigType(localVariableOperand.Type));
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:27,代码来源:LdlocaInstruction.cs


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