當前位置: 首頁>>代碼示例>>C#>>正文


C# TypeSystem.RuntimeMethod類代碼示例

本文整理匯總了C#中Mosa.Compiler.TypeSystem.RuntimeMethod的典型用法代碼示例。如果您正苦於以下問題:C# RuntimeMethod類的具體用法?C# RuntimeMethod怎麽用?C# RuntimeMethod使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RuntimeMethod類屬於Mosa.Compiler.TypeSystem命名空間,在下文中一共展示了RuntimeMethod類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Mosa.Compiler.TypeSystem.RuntimeMethod類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。