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


C# IInstructionDecoder.DecodeTokenType方法代码示例

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


在下文中一共展示了IInstructionDecoder.DecodeTokenType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 base classes first
            base.Decode(ctx, decoder);

            // Load the _stackFrameIndex token from the immediate
            TokenTypes token = decoder.DecodeTokenType();

            //Console.WriteLine("Stfld used in {0}.{1}", decoder.Method.DeclaringType.FullName, decoder.Method.Name);

            Debug.Assert(TokenTypes.Field == (TokenTypes.TableMask & token) || TokenTypes.MemberRef == (TokenTypes.TableMask & token), @"Invalid token type.");

            ctx.RuntimeField = decoder.ModuleTypeSystem.GetField(token);

            if (ctx.RuntimeField.ContainsGenericParameter)
            {
                foreach (RuntimeField field in decoder.Method.DeclaringType.Fields)
                    if (field.Name == ctx.RuntimeField.Name)
                    {
                        ctx.RuntimeField = field;
                        break;
                    }

                Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
            }
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:31,代码来源:StfldInstruction.cs

示例2: 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)
        {
            base.Decode(ctx, decoder);

            Token token = decoder.DecodeTokenType();
            ctx.RuntimeField = decoder.Method.Module.GetField(token);

            // FIXME: Can this be put into a re-used method?
            if (ctx.RuntimeField.ContainsGenericParameter || ctx.RuntimeField.DeclaringType.ContainsOpenGenericParameters)
            {
                foreach (var field in decoder.Method.DeclaringType.Fields)
                {
                    if (field.Name == ctx.RuntimeField.Name)
                    {
                        ctx.RuntimeField = field;
                        break;
                    }
                }

                if (ctx.RuntimeField.ContainsGenericParameter)
                {
                    ctx.RuntimeField = decoder.GenericTypePatcher.PatchField(decoder.TypeModule, decoder.Method.DeclaringType as CilGenericType, ctx.RuntimeField);
                }
                decoder.Compiler.Scheduler.TrackFieldReferenced(ctx.RuntimeField);
                Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
            }

            SigType sigType = new RefSigType(ctx.RuntimeField.SignatureType);
            ctx.Result = LoadInstruction.CreateResultOperand(decoder, Operand.StackTypeFromSigType(sigType), sigType);
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:35,代码来源:LdfldaInstruction.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);

            Token token = decoder.DecodeTokenType();
            ITypeModule module = null;
            Mosa.Runtime.TypeSystem.Generic.CilGenericType genericType = decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType;
            if (genericType != null)
                module = (decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType).BaseGenericType.Module;
            else
                module = decoder.Method.Module;
            ctx.RuntimeField = module.GetField(token);

            if (ctx.RuntimeField.ContainsGenericParameter)
            {
                foreach (RuntimeField field in decoder.Method.DeclaringType.Fields)
                    if (field.Name == ctx.RuntimeField.Name)
                    {
                        ctx.RuntimeField = field;
                        break;
                    }

                Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
            }

            SigType sigType = ctx.RuntimeField.SignatureType;
            ctx.Result = LoadInstruction.CreateResultOperand(decoder, Operand.StackTypeFromSigType(sigType), sigType);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:34,代码来源:LdfldInstruction.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);

            // Load the _stackFrameIndex token from the immediate
            Token token = decoder.DecodeTokenType();

            //Console.WriteLine("Stfld used in {0}.{1}", decoder.Method.DeclaringType.FullName, decoder.Method.Name);

            Debug.Assert(token.Table == TableType.Field || token.Table == TableType.MemberRef, @"Invalid token type.");

            ITypeModule module = null;
            Mosa.Runtime.TypeSystem.Generic.CilGenericType genericType = decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType;
            if (genericType != null)
                module = (decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType).BaseGenericType.Module;
            else
                module = decoder.Method.Module;

            ctx.RuntimeField = module.GetField(token);

            if (ctx.RuntimeField.ContainsGenericParameter)
            {
                foreach (RuntimeField field in decoder.Method.DeclaringType.Fields)
                    if (field.Name == ctx.RuntimeField.Name)
                    {
                        ctx.RuntimeField = field;
                        break;
                    }

                Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
            }
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:38,代码来源:StfldInstruction.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);

            // Retrieve the provider token to check against
            TokenTypes token = decoder.DecodeTokenType();

            ctx.Result = decoder.Compiler.CreateTemporary(new ClassSigType(token));
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:15,代码来源:LdelemaInstruction.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);

            // Retrieve the provider token to check against
            Token token = decoder.DecodeTokenType();

            ctx.Other = decoder.TypeModule.GetType(token);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:15,代码来源:BoxInstruction.cs

示例7: 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);

            // Retrieve the type reference
            Token token = decoder.DecodeTokenType();

            decoder.TypeModule.GetType(token);
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:15,代码来源:InitObjInstruction.cs

示例8: 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);

            // Retrieve a type reference from the immediate argument
            // FIXME: Limit the token types
            Token token = decoder.DecodeTokenType();

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

示例9: 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);

            Token token = decoder.DecodeTokenType();

            //RuntimeType type = decoder.TypeModule.GetType(token);

            ctx.Result = decoder.Compiler.CreateTemporary(new ClassSigType(token));
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:16,代码来源:CastclassInstruction.cs

示例10: 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);

            TokenTypes token = decoder.DecodeTokenType();

            RuntimeType type = decoder.ModuleTypeSystem.GetType(token);

            ctx.Result = decoder.Compiler.CreateTemporary(new ClassSigType(token));
            //throw new NotImplementedException();
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:17,代码来源:IsInstInstruction.cs

示例11: 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);
     // Retrieve the type token
     Token token = decoder.DecodeTokenType();
     ctx.Other = decoder.TypeModule.GetType (token);
     /*
         _constraint = MetadataTypeReference.FromToken(decoder.Metadata, token);
         Debug.Assert(null != _constraint);
      */
 }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:17,代码来源:ConstrainedPrefixInstruction.cs

示例12: 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);

            Token token = decoder.DecodeTokenType();
            RuntimeType type = decoder.TypeModule.GetType(token);

            uint size = (uint)decoder.Compiler.TypeLayout.GetTypeSize(type);

            ctx.Result = new Operands.ConstantOperand(BuiltInSigType.UInt32, size);
        }
开发者ID:grover,项目名称:MOSA-Project,代码行数:17,代码来源:SizeofInstruction.cs

示例13: 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);

            // Read the fn token
            Token token = decoder.DecodeTokenType();
            ctx.Result = decoder.Compiler.CreateVirtualRegister(BuiltInSigType.IntPtr);
            ctx.InvokeTarget = decoder.TypeModule.GetMethod(token);

            decoder.Compiler.Scheduler.TrackMethodInvoked(ctx.InvokeTarget);
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:17,代码来源:LdftnInstruction.cs

示例14: 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);

            // Load the string value, it's a token
            TokenTypes token = decoder.DecodeTokenType();
            token |= TokenTypes.UserString;

            // Set the result
            ctx.Token = token;
            ctx.Result = decoder.Compiler.CreateTemporary(BuiltInSigType.String);
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:18,代码来源:LdstrInstruction.cs

示例15: 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);

            // Retrieve the type token
            TokenTypes token = decoder.DecodeTokenType();
            throw new NotImplementedException();
            /*
                _constraint = MetadataTypeReference.FromToken(decoder.Metadata, token);
                Debug.Assert(null != _constraint);
             */
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:18,代码来源:ConstrainedPrefixInstruction.cs


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