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

C# TypeSystem.RuntimeMethod类代码示例

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

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



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

示例1: TestCaseMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="TestCaseMethodCompiler"/> class.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        /// <param name="method">The method.</param>
        public TestCaseMethodCompiler(TestCaseCompiler compiler, RuntimeMethod method)
            : base(compiler, method, null)
        {
            // Populate the pipeline
            Pipeline.AddRange(new IMethodCompilerStage[] {
                new CILDecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandAssignmentStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),

                new LocalVariablePromotionStage(),
                new	EdgeSplitStage(),
                new DominanceCalculationStage(),
                new PhiPlacementStage(),
                new EnterSSAStage(),
                new SSAOptimizations(),
                new LeaveSSA(),

                new StackLayoutStage(),
                new PlatformIntrinsicTransformationStage(),
                new PlatformStubStage(),
                new LoopAwareBlockOrderStage(),
                //new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                new CodeGenerationStage(),
            });
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:34,代码来源:TestCaseMethodCompiler.cs


示例2: Parse

        /// <summary>
        /// Parses the specified attribute blob and instantiates the attribute.
        /// </summary>
        /// <param name="blob">The BLOB.</param>
        /// <param name="attributeCtor">The constructor of the attribute.</param>
        /// <returns>
        /// The fully instantiated and initialized attribute.
        /// </returns>
        public static object[] Parse(byte[] blob, RuntimeMethod attributeCtor)
        {
            if (blob == null)
                throw new ArgumentException(@"Invalid attribute blob token.", @"attributeBlob");

            if (blob.Length == 0)
                return null;

            // Create a binary reader for the blob
            using (var reader = new BinaryReader(new MemoryStream(blob), Encoding.UTF8))
            {
                var prologue = reader.ReadUInt16();
                Debug.Assert(prologue == ATTRIBUTE_BLOB_PROLOGUE, @"Attribute prologue doesn't match.");
                if (prologue != ATTRIBUTE_BLOB_PROLOGUE)
                    throw new ArgumentException(@"Invalid custom attribute blob.", "attributeBlob");

                var parameters = attributeCtor.Parameters.Count;

                object[] args = new object[parameters];
                for (int idx = 0; idx < parameters; idx++)
                    args[idx] = ParseFixedArg(reader, attributeCtor.Signature.Parameters[idx]);

                // Create the attribute instance
                return args;
            }
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:34,代码来源:CustomAttributeParser.cs


示例3: RuntimeAttribute

 /// <summary>
 /// Initializes a new instance of the <see cref="RuntimeAttribute"/> class.
 /// </summary>
 /// <param name="typeModule">The type module.</param>
 /// <param name="ctor">The ctor.</param>
 /// <param name="ctorMethod">The ctor method.</param>
 /// <param name="blobIndex">Index of the blob.</param>
 public RuntimeAttribute(ITypeModule typeModule, Token ctor, RuntimeMethod ctorMethod, HeapIndexToken blobIndex)
 {
     this.typeModule = typeModule;
     this.ctorMethod = ctorMethod;
     this.ctor = ctor;
     this.blobIndex = blobIndex;
 }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:14,代码来源:RuntimeAttribute.cs


示例4: TestCaseMethodCompiler

        public TestCaseMethodCompiler(TestCaseAssemblyCompiler assemblyCompiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
            : base(assemblyCompiler, type, method, null, compilationScheduler)
        {
            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandDeterminationStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),
                //new CILLeakGuardStage() { MustThrowCompilationException = true },

                new	EdgeSplitStage(),
                new DominanceCalculationStage(),
                new PhiPlacementStage(),
                new EnterSSAStage(),

                new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PreFolding),
                new ConstantFoldingStage() ,
                new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PostFolding),

                new LeaveSSA(),

                new StrengthReductionStage(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new BlockReductionStage(),
                //new LoopAwareBlockOrderStage(),
                new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                //new BasicBlockOrderStage()
                new CodeGenerationStage(),
            });
        }
开发者ID:toddhainsworth,项目名称:MOSA-Project,代码行数:35,代码来源:TestCaseMethodCompiler.cs


示例5: ExplorerMethodCompiler

        public ExplorerMethodCompiler(ExplorerAssemblyCompiler assemblyCompiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method, CompilerOptions compilerOptions)
            : base(assemblyCompiler, type, method, null, compilationScheduler)
        {
            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandDeterminationStage(),
                //new SingleUseMarkerStage(),
                //new OperandUsageAnalyzerStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),

                (compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
                (compilerOptions.EnableSSA) ? new DominanceCalculationStage() : null,
                (compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
                (compilerOptions.EnableSSA) ? new EnterSSAStage() : null,

                (compilerOptions.EnableSSA) ? new SSAOptimizations() : null,
                //(compilerOptions.EnableSSA) ? new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PreFolding) : null,
                //(compilerOptions.EnableSSA) ? new ConstantFoldingStage() : null,
                //(compilerOptions.EnableSSA) ? new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PostFolding) : null,

                (compilerOptions.EnableSSA) ? new LeaveSSA() : null,

                new StrengthReductionStage(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new LoopAwareBlockOrderStage(),
                new SimpleTraceBlockOrderStage(),
                //new SimpleRegisterAllocatorStage(),
                new CodeGenerationStage(),
            });
        }
开发者ID:grover,项目名称:MOSA-Project,代码行数:35,代码来源:ExplorerMethodCompiler.cs


示例6: AotMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="AotMethodCompiler"/> class.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        /// <param name="method">The method.</param>
        public AotMethodCompiler(BaseCompiler compiler, RuntimeMethod method)
            : base(compiler, method, null)
        {
            var compilerOptions = compiler.CompilerOptions;

            Pipeline.AddRange(new IMethodCompilerStage[] {
                new CILDecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandAssignmentStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),

                new IRCheckStage(),

                (compilerOptions.EnableSSA && compilerOptions.EnableSSAOptimizations) ? new LocalVariablePromotionStage() : null,
                (compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
                (compilerOptions.EnableSSA) ? new DominanceCalculationStage() : null,
                (compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
                (compilerOptions.EnableSSA) ? new EnterSSAStage() : null,
                (compilerOptions.EnableSSA && compilerOptions.EnableSSAOptimizations) ? new SSAOptimizations() : null,
                (compilerOptions.EnableSSA) ? new LeaveSSA() : null,

                new StackLayoutStage(),
                new PlatformIntrinsicTransformationStage(),
                new PlatformStubStage(),
                new LoopAwareBlockOrderStage(),
                //new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),
                //new LocalCSE(),
                new CodeGenerationStage(),
                //new RegisterUsageAnalyzerStage(),
            });
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:39,代码来源:AotMethodCompiler.cs


示例7: CompileMethod

        void ICompilationScheduler.TrackMethodInvoked(RuntimeMethod method)
        {
            methodsInvoked.AddIfNew(method);

            if (compileAllMethods)
                CompileMethod(method);
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:7,代码来源:CompilationScheduler.cs


示例8: MemberOperand

        /// <summary>
        /// Initializes a new instance of the <see cref="MemberOperand"/> class.
        /// </summary>
        /// <param name="method">The method to reference.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="method"/> is null.</exception>
        public MemberOperand(RuntimeMethod method)
            : base(null, BuiltInSigType.IntPtr, IntPtr.Zero)
        {
            if (method == null)
                throw new ArgumentNullException(@"method");

            this.member = method;
        }
开发者ID:grover,项目名称:MOSA-Project,代码行数:13,代码来源:MemberOperand.cs


示例9: GetPlugMethod

        /// <summary>
        /// Gets the plug.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <returns></returns>
        public RuntimeMethod GetPlugMethod(RuntimeMethod method)
        {
            RuntimeMethod plug = null;

            plugMethods.TryGetValue(method, out plug);

            return plug;
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:13,代码来源:PlugSystem.cs


示例10: ArgumentNullException

        void ICompilationSchedulerStage.ScheduleMethodForCompilation(RuntimeMethod method)
        {
            if (method == null)
                throw new ArgumentNullException(@"method");

            if (!method.IsGeneric)
            {
                Trace(CompilerEvent.SchedulingMethod, method.ToString());
                methodQueue.Enqueue(method);
            }
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:11,代码来源:MethodCompilerSchedulerStage.cs


示例11: LinkerMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="LinkerMethodCompiler"/> class.
        /// </summary>
        /// <param name="assemblyCompiler">The assembly compiler executing this method compiler.</param>
        /// <param name="method">The metadata of the method to compile.</param>
        /// <param name="instructionSet">The instruction set.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="assemblyCompiler"/>, <paramref name="method"/> or <paramref name="instructionSet"/> is null.</exception>
        public LinkerMethodCompiler(AssemblyCompiler assemblyCompiler, ICompilationSchedulerStage compilationScheduler, RuntimeMethod method, InstructionSet instructionSet)
            : base(assemblyCompiler, method.DeclaringType, method,  instructionSet, compilationScheduler)
        {
            this.CreateBlock(-1, 0);

            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new SimpleTraceBlockOrderStage(),
                new PlatformStubStage(),
                new CodeGenerationStage(),
            });

            assemblyCompiler.Architecture.ExtendMethodCompilerPipeline(this.Pipeline);
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:20,代码来源:LinkerMethodCompiler.cs


示例12: LinkerMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="LinkerMethodCompiler"/> class.
        /// </summary>
        /// <param name="compiler">The assembly compiler executing this method compiler.</param>
        /// <param name="method">The metadata of the method to compile.</param>
        /// <param name="instructionSet">The instruction set.</param>
        public LinkerMethodCompiler(BaseCompiler compiler, RuntimeMethod method, InstructionSet instructionSet)
            : base(compiler, method, instructionSet)
        {
            BasicBlocks.CreateBlock(BasicBlock.PrologueLabel, 0);
            BasicBlocks.AddHeaderBlock(BasicBlocks.PrologueBlock);

            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new LoopAwareBlockOrderStage(),
                new PlatformStubStage(),
                new CodeGenerationStage(),
            });

            compiler.Architecture.ExtendMethodCompilerPipeline(this.Pipeline);
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:20,代码来源:LinkerMethodCompiler.cs


示例13: HasGenericParameters

        /// <summary>
        /// Determines if the given method is a method 
        /// of a generic class that uses a generic parameter.
        /// </summary>
        /// <param name="method">The method to check</param>
        /// <returns>True if the method relies upon generic parameters</returns>
        public static bool HasGenericParameters(RuntimeMethod method)
        {
            // Check return type
            if (IsGenericParameter(method.Signature.ReturnType))
                return true;

            // Check parameters
            foreach (SigType parameter in method.Signature.Parameters)
            {
                if (IsGenericParameter(parameter))
                    return true;
            }

            return false;
        }
开发者ID:grover,项目名称:MOSA-Project,代码行数:21,代码来源:GenericsResolverStage.cs


示例14: Run

        public static void Run(IInternalTrace internalLog, IPipelineStage stage, RuntimeMethod method, InstructionSet instructionSet, BasicBlocks basicBlocks)
        {
            if (internalLog == null)
                return;

            if (internalLog.TraceListener == null)
                return;

            if (!internalLog.TraceFilter.IsMatch(method, stage.Name))
                return;

            StringBuilder text = new StringBuilder();

            // Line number
            int index = 1;

            text.AppendLine(String.Format("IR representation of method {0} after stage {1}:", method, stage.Name));
            text.AppendLine();

            if (basicBlocks.Count > 0)
            {
                foreach (BasicBlock block in basicBlocks)
                {
                    text.AppendFormat("Block #{0} - Label L_{1:X4}", index, block.Label);
                    if (basicBlocks.IsHeaderBlock(block))
                        text.Append(" [Header]");
                    text.AppendLine();

                    text.AppendFormat("  Prev: ");
                    text.AppendLine(ListBlocks(block.PreviousBlocks));

                    LogInstructions(text, new Context(instructionSet, block));

                    text.AppendFormat("  Next: ");
                    text.AppendLine(ListBlocks(block.NextBlocks));

                    text.AppendLine();
                    index++;
                }
            }
            else
            {
                LogInstructions(text, new Context(instructionSet, 0));
            }

            internalLog.TraceListener.SubmitInstructionTraceInformation(method, stage.Name, text.ToString());
        }
开发者ID:grover,项目名称:MOSA-Project,代码行数:47,代码来源:InstructionLogger.cs


示例15: CompileMethod

        private void CompileMethod(RuntimeMethod method)
        {
            Trace(CompilerEvent.CompilingMethod, method.ToString());

            using (IMethodCompiler mc = compiler.CreateMethodCompiler(this, method.DeclaringType, method))
            {
                mc.Compile();

                //try
                //{
                //    mc.Compile();
                //}
                //catch (Exception e)
                //{
                //    HandleCompilationException(e);
                //    throw;
                //}
            }
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:19,代码来源:MethodCompilerSchedulerStage.cs


示例16: RecompileMethods

 private static List<RuntimeMethod> RecompileMethods(AssemblyCompiler compiler, List<Token> types, RuntimeMethod method)
 {
     throw new NotImplementedException();
 }
开发者ID:grover,项目名称:MOSA-Project,代码行数:4,代码来源:GenericsResolverStage.cs


示例17: ReinsertMethods

 private static void ReinsertMethods(List<RuntimeMethod> methods, RuntimeMethod method, RuntimeType type)
 {
     throw new NotImplementedException();
 }
开发者ID:grover,项目名称:MOSA-Project,代码行数:4,代码来源:GenericsResolverStage.cs


示例18: FindOverrideSlot

        private int FindOverrideSlot(IList<RuntimeMethod> methodTable, RuntimeMethod method)
        {
            foreach (var baseMethod in methodTable)
            {
                if (baseMethod.Name.Equals(method.Name) && baseMethod.Signature.Matches(method.Signature))
                {
                    return methodTableOffsets[baseMethod];
                }
            }

            throw new InvalidOperationException(@"Failed to find override method slot.");
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:12,代码来源:TypeLayout.cs


示例19: GetTokenTypesForMethod

 private static List<Token> GetTokenTypesForMethod(AssemblyCompiler compiler, RuntimeType type, RuntimeMethod method)
 {
     throw new NotImplementedException();
 }
开发者ID:grover,项目名称:MOSA-Project,代码行数:4,代码来源:GenericsResolverStage.cs


示例20: FindInterfaceMethod

        private RuntimeMethod FindInterfaceMethod(RuntimeType type, RuntimeMethod interfaceMethod)
        {
            var cleanInterfaceMethodName = GetCleanMethodName(interfaceMethod.Name);

            foreach (var method in type.Methods)
            {
                string cleanMethodName = GetCleanMethodName(method.Name);

                if (cleanInterfaceMethodName.Equals(cleanMethodName))
                {
                    if (interfaceMethod.Signature.Matches(method.Signature))
                    {
                        return method;
                    }
                }
            }

            if (type.BaseType != null)
            {
                return FindInterfaceMethod(type.BaseType, interfaceMethod);
            }

            throw new InvalidOperationException(@"Failed to find implicit interface implementation for type " + type + " and interface method " + interfaceMethod);
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:24,代码来源:TypeLayout.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CompilerFramework.BasicBlock类代码示例发布时间:2022-05-26
下一篇:
C# MosaTypeSystem.TypeSystem类代码示例发布时间: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