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

C# RuntimeMethod类代码示例

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

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



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

示例1: TestCaseMethodCompiler

 public TestCaseMethodCompiler(IAssemblyLinker linker, IArchitecture architecture, IMetadataModule module, RuntimeType type, RuntimeMethod method)
     : base(linker, architecture, module, type, method)
 {
     // Populate the pipeline
     this.Pipeline.AddRange(new IMethodCompilerStage[] {
         new DecodingStage(),
         new BasicBlockBuilderStage(),
         new OperandDeterminationStage(),
         new InstructionLogger(),
         //new ConstantFoldingStage(),
         new CILTransformationStage(),
         //new InstructionLogger(),
         //InstructionStatisticsStage.Instance,
         //new DominanceCalculationStage(),
         //new EnterSSA(),
         //new ConstantPropagationStage(),
         //new ConstantFoldingStage(),
         //new LeaveSSA(),
         new StackLayoutStage(),
         new PlatformStubStage(),
         new InstructionLogger(),
         //new BlockReductionStage(),
         new LoopAwareBlockOrderStage(),
         //new SimpleTraceBlockOrderStage(),
         //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
         //new BasicBlockOrderStage()
         new CodeGenerationStage(),
         //new InstructionLogger(),
     });
 }
开发者ID:shanebrown99,项目名称:MOSA-Project,代码行数:30,代码来源:TestCaseMethodCompiler.cs


示例2: ArgumentNullException

        void IJitService.SetupJit(RuntimeMethod method)
        {
            // Check preconditions
            if (null == method)
                throw new ArgumentNullException(@"method");
            Debug.Assert(MethodImplAttributes.IL == (method.ImplAttributes & MethodImplAttributes.IL), @"Non-IL method passed to IJitService.SetupJit");
            if (MethodImplAttributes.IL != (method.ImplAttributes & MethodImplAttributes.IL))
                throw new ArgumentException(@"Non-IL method passed to IJitService.SetupJit.", @"method");

            // Code the appropriate trampoline
            /*
                        if (method.DeclaringType.IsGeneric) {
                            FIXME: method.DeclaringType is always null right now
             *              the loader doesn't initialize these properly.
                        }
             */
            if (method.IsGeneric)
            {
                // Emit a generic call trampoline
                method.Address = EmitGenericMethodTrampoline();
            }
            else
            {
                // A normal call trampoline
                method.Address = EmitStandardTrampoline(method);
            }
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:27,代码来源:SimpleJitService.cs


示例3: CreateMethodCompiler

 public override MethodCompilerBase CreateMethodCompiler(RuntimeType type, RuntimeMethod method)
 {
     IArchitecture arch = this.Architecture;
     MethodCompilerBase mc = new TestCaseMethodCompiler(this.Pipeline.Find<IAssemblyLinker>(), this.Architecture, this.Assembly, type, method);
     arch.ExtendMethodCompilerPipeline(mc.Pipeline);
     return mc;
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:7,代码来源:TestCaseAssemblyCompiler.cs


示例4: SimpleJitMethodCompiler

        public SimpleJitMethodCompiler(AssemblyCompiler compiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method, Stream codeStream, ITypeSystem typeSystem)
            : base(compiler.Pipeline.FindFirst<IAssemblyLinker>(), compiler.Architecture, compilationScheduler, type, method, typeSystem, compiler.Pipeline.FindFirst<ITypeLayout>())
        {
            if (codeStream == null)
                throw new ArgumentNullException(@"codeStream");

            this.codeStream = codeStream;
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:8,代码来源:SimpleJitMethodCompiler.cs


示例5: 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(new SigType(CilElementType.I), null, IntPtr.Zero)
        {
            if (method == null)
                throw new ArgumentNullException(@"method");

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


示例6: MethodCompiler

        public MethodCompiler(IAssemblyLinker linker, IArchitecture architecture, IMetadataModule module, RuntimeType type, RuntimeMethod method, Stream codeStream)
            : base(linker, architecture, module, type, method)
        {
            if (null == codeStream)
                throw new ArgumentNullException(@"codeStream");

            _codeStream = codeStream;
        }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:8,代码来源:MethodCompiler.cs


示例7: CreateMethodCompiler

 /// <summary>
 /// Creates a method compiler
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="method">The method to compile.</param>
 /// <returns>
 /// An instance of a MethodCompilerBase for the given type/method pair.
 /// </returns>
 public override MethodCompilerBase CreateMethodCompiler(RuntimeType type, RuntimeMethod method)
 {
     MethodCompilerBase mc = new AotMethodCompiler(
         this,
         type,
         method
     );
     this.Architecture.ExtendMethodCompilerPipeline(mc.Pipeline);
     return mc;
 }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:18,代码来源:AotCompiler.cs


示例8: 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>
 /// <exception cref="System.ArgumentNullException"><paramref name="compiler"/>, <paramref name="method"/> or <paramref name="instructionSet"/> is null.</exception>
 public LinkerMethodCompiler(AssemblyCompiler compiler, RuntimeMethod method, InstructionSet instructionSet)
     : base(compiler.Pipeline.Find<IAssemblyLinker>(), compiler.Architecture, compiler.Assembly, method.DeclaringType, method)
 {
     InstructionSet = instructionSet;
     this.Pipeline.AddRange(new IMethodCompilerStage[] {
         new BasicBlockBuilderStage(),
         new CodeGenerationStage(),
     });
     compiler.Architecture.ExtendMethodCompilerPipeline(this.Pipeline);
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:17,代码来源:LinkerMethodCompiler.cs


示例9: Call

 /// <summary>
 /// Calls the specified target.
 /// </summary>
 /// <param name="target">The target.</param>
 public void Call(RuntimeMethod target)
 {
     _linker.Link(
         LinkType.RelativeOffset | LinkType.I4,
         _compiler.Method,
         (int)(_codeStream.Position - _codeStreamBasePosition) - 4,
         (int)(_codeStream.Position - _codeStreamBasePosition),
         target,
         IntPtr.Zero
     );
 }
开发者ID:shanebrown99,项目名称:MOSA-Project,代码行数:15,代码来源:MachineCodeEmitter.cs


示例10: CreateMethodCompiler

 /// <summary>
 /// Creates a method compiler
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="method">The method to compile.</param>
 /// <returns>
 /// An instance of a MethodCompilerBase for the given type/method pair.
 /// </returns>
 public override IMethodCompiler CreateMethodCompiler(ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
 {
     IMethodCompiler mc = new AotMethodCompiler(
         this,
         compilationScheduler,
         type,
         method
     );
     this.Architecture.ExtendMethodCompilerPipeline(mc.Pipeline);
     return mc;
 }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:19,代码来源:AotCompiler.cs


示例11: 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>
        /// <exception cref="System.ArgumentNullException"><paramref name="compiler"/>, <paramref name="method"/> or <paramref name="instructionSet"/> is null.</exception>
        public LinkerMethodCompiler(AssemblyCompiler compiler, ICompilationSchedulerStage compilationScheduler, RuntimeMethod method, InstructionSet instructionSet)
            : base(compiler.Pipeline.FindFirst<IAssemblyLinker>(), compiler.Architecture, compilationScheduler, compiler.Assembly, method.DeclaringType, method)
        {
            this.InstructionSet = instructionSet;
            this.CreateBlock(-1, 0);

            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new SimpleTraceBlockOrderStage(),
                new PlatformStubStage(),
                new CodeGenerationStage(),
            });
            compiler.Architecture.ExtendMethodCompilerPipeline(this.Pipeline);
        }
开发者ID:davidbjornn,项目名称:MOSA-Project,代码行数:20,代码来源:LinkerMethodCompiler.cs


示例12: ScheduleMethodForCompilation

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

            if (method.IsGeneric == false)
            {
                Console.WriteLine(@"Scheduling method {1}.{0} for compilation.", method.Name, method.DeclaringType.FullName);
                Debug.WriteLine(String.Format(@"Scheduling method {1}.{0} for compilation.", method.Name, method.DeclaringType.FullName));

                this.methodQueue.Enqueue(method);
            }
        }
开发者ID:davidbjornn,项目名称:MOSA-Project,代码行数:13,代码来源:MethodCompilerSchedulerStage.cs


示例13: Parse

        /// <summary>
        /// Parses the specified attribute blob and instantiates the attribute.
        /// </summary>
        /// <param name="module">The metadata module, which contains the attribute blob.</param>
        /// <param name="attributeBlob">The attribute blob token.</param>
        /// <param name="attributeCtor">The constructor of the attribute.</param>
        /// <returns>The fully instantiated and initialized attribute.</returns>
        /// <exception cref="System.ArgumentException"><paramref name="attributeBlob"/> is invalid.</exception>
        /// <exception cref="System.ArgumentNullException"><paramref name="module"/> is null or <paramref name="attributeCtor"/> is null.</exception>
        public static object Parse(IMetadataModule module, TokenTypes attributeBlob, RuntimeMethod attributeCtor)
        {
            // Return value
            object result;

            // Try to load the blob from the module
            byte[] blob = module.Metadata.ReadBlob(attributeBlob);
            if (null != blob)
            {
                if (0 != blob.Length)
                {
                    // Create a binary reader for the blob
                    using (BinaryReader reader = new BinaryReader(new MemoryStream(blob), Encoding.UTF8))
                    {
                        ushort prologue = reader.ReadUInt16();
                        Debug.Assert(ATTRIBUTE_BLOB_PROLOGUE == prologue, @"Attribute prologue doesn't match.");
                        if (prologue != ATTRIBUTE_BLOB_PROLOGUE)
                            throw new ArgumentException(@"Invalid custom attribute blob.", "attributeBlob");

                        // Fixed argument list of the ctor
                        SigType[] paramSig = attributeCtor.Signature.Parameters;
                        IList<RuntimeParameter> parameters = attributeCtor.Parameters;
                        object[] args = new object[parameters.Count];
                        for (int idx = 0; idx < parameters.Count; idx++)
                            args[idx] = ParseFixedArg(module, reader, paramSig[idx]);

                        // Create the attribute instance
                        result = CreateAttribute(attributeCtor, args);

                        // Are there any named args?
                        ushort numNamed = reader.ReadUInt16();
                        for (ushort idx = 0; idx < numNamed; idx++)
                        {
                            // FIXME: Process the named arguments
                            Trace.WriteLine(@"Skipping named argument of an attribute.");
                        }
                    }
                }
                else
                {
                    result = CreateAttribute(attributeCtor, null);
                }
            }
            else
            {
                throw new ArgumentException(@"Invalid attribute blob token.", @"attributeBlob");
            }

            return result;
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:59,代码来源:CustomAttributeParser.cs


示例14: 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:hj1980,项目名称:MOSA-Project,代码行数:21,代码来源:GenericsResolverStage.cs


示例15: AotMethodCompiler

 /// <summary>
 /// Initializes a new instance of the <see cref="AotMethodCompiler"/> class.
 /// </summary>
 public AotMethodCompiler(AssemblyCompiler compiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
     : base(compiler.Pipeline.FindFirst<IAssemblyLinker>(), compiler.Architecture, compilationScheduler, type, method, compiler.TypeSystem, compiler.Pipeline.FindFirst<ITypeLayout>())
 {
     this.assemblyCompiler = compiler;
     this.Pipeline.AddRange(
         new IMethodCompilerStage[]
         {
             new DecodingStage(),
             //InstructionLogger.Instance,
             new BasicBlockBuilderStage(),
             //InstructionLogger.Instance,
             new OperandDeterminationStage(),
             InstructionLogger.Instance,
             StaticAllocationResolutionStageWrapper.Instance,
             //InstructionLogger.Instance,
             new CILTransformationStage(),
             InstructionLogger.Instance,
             //InstructionStatisticsStage.Instance,
             //new DominanceCalculationStage(),
             //InstructionLogger.Instance,
             //new EnterSSA(),
             //InstructionLogger.Instance,
             //new ConstantPropagationStage(),
             //InstructionLogger.Instance,
             //new ConstantFoldingStage(),
             //new StrengthReductionStage(),
             //InstructionLogger.Instance,
             //new LeaveSSA(),
             //InstructionLogger.Instance,
             new StackLayoutStage(),
             //InstructionLogger.Instance,
             new PlatformStubStage(),
             InstructionLogger.Instance,
             //new BlockReductionStage(),
             new LoopAwareBlockOrderStage(),
             //InstructionLogger.Instance,
             //new SimpleTraceBlockOrderStage(),
             //new ReverseBlockOrderStage(),
             //new LocalCSE(),
             new CodeGenerationStage(),
         });
 }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:45,代码来源:AotMethodCompiler.cs


示例16: AotMethodCompiler

 /// <summary>
 /// Initializes a new instance of the <see cref="AotMethodCompiler"/> class.
 /// </summary>
 /// <param name="compiler">The AOT assembly compiler.</param>
 /// <param name="type">The type.</param>
 /// <param name="method">The method.</param>
 public AotMethodCompiler(AotCompiler compiler, RuntimeType type, RuntimeMethod method)
     : base(compiler.Pipeline.Find<IAssemblyLinker>(), compiler.Architecture, compiler.Assembly, type, method)
 {
     aotCompiler = compiler;
     Pipeline.AddRange(new IMethodCompilerStage[] {
         new DecodingStage(),
         new InstructionLogger(typeof(DecodingStage)),
         new BasicBlockBuilderStage(),
         new InstructionLogger(typeof(BasicBlockBuilderStage)),
         new OperandDeterminationStage(),
         new InstructionLogger(typeof(OperandDeterminationStage)),
         new CILTransformationStage(),
         new InstructionLogger(typeof(CILTransformationStage)),
         //InstructionStatisticsStage.Instance,
         new DominanceCalculationStage(),
         new InstructionLogger(typeof(DominanceCalculationStage)),
         //new EnterSSA(),
         //new InstructionLogger(typeof(EnterSSA)),
         //new ConstantPropagationStage(),
         //InstructionLogger.Instance,
         //new ConstantFoldingStage(),
         //new StrengthReductionStage(),
         //InstructionLogger.Instance,
         //new LeaveSSA(),
         //InstructionLogger.Instance,
         //InstructionLogger.Instance,
         new StackLayoutStage(),
         new InstructionLogger(typeof(StackLayoutStage)),
         //InstructionLogger.Instance,
         //new BlockReductionStage(),
         new LoopAwareBlockOrderStage(),
         new InstructionLogger(typeof(LoopAwareBlockOrderStage)),
         //new SimpleTraceBlockOrderStage(),
         //new ReverseBlockOrderStage(),
     //		InstructionStatisticsStage.Instance,
         //new LocalCSE(),
         new CodeGenerationStage(),
     });
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:45,代码来源:AotMethodCompiler.cs


示例17: TestCaseMethodCompiler

        public TestCaseMethodCompiler(TestCaseAssemblyCompiler compiler, IArchitecture architecture, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
            : base(compiler.Pipeline.FindFirst<IAssemblyLinker>(), architecture, compilationScheduler, type, method, compiler.TypeSystem, compiler.Pipeline.FindFirst<ITypeLayout>())
        {
            this.assemblyCompiler = compiler;

            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                //new InstructionLogger(),
                new BasicBlockBuilderStage(),
                //new InstructionLogger(),
                new OperandDeterminationStage(),
                //new InstructionLogger(),
                new StaticAllocationResolutionStage(),
                //new InstructionLogger(),
                //new ConstantFoldingStage(),
                new CILTransformationStage(),
                //new InstructionLogger(),
                new CILLeakGuardStage() { MustThrowCompilationException = true },
                //new InstructionLogger(),
                //InstructionStatisticsStage.Instance,
                //new DominanceCalculationStage(),
                //new EnterSSA(),
                //new ConstantPropagationStage(),
                //new ConstantFoldingStage(),
                //new LeaveSSA(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new InstructionLogger(),
                //new BlockReductionStage(),
                new LoopAwareBlockOrderStage(),
                //new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                //new BasicBlockOrderStage()
                new CodeGenerationStage(),
                //new InstructionLogger(),
            });
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:38,代码来源:TestCaseMethodCompiler.cs


示例18: Link

 /// <summary>
 /// Issues a linker request for the given runtime method.
 /// </summary>
 /// <param name="linkType">The type of link required.</param>
 /// <param name="method">The method the patched code belongs to.</param>
 /// <param name="methodOffset">The offset inside the method where the patch is placed.</param>
 /// <param name="methodRelativeBase">The base address, if a relative link is required.</param>
 /// <param name="symbol">The linker symbol to link against.</param>
 /// <returns>
 /// The return value is the preliminary address to place in the generated machine
 /// code. On 32-bit systems, only the lower 32 bits are valid. The above are not used. An implementation of
 /// IAssemblyLinker may not rely on 64-bits being stored in the memory defined by position.
 /// </returns>
 public virtual long Link(LinkType linkType, RuntimeMethod method, int methodOffset, int methodRelativeBase, string symbol)
 {
     return 0;
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:17,代码来源:ObjectFileBuilderBase.cs


示例19: Schedule

 /// <summary>
 /// Schedules the specified method for invocation in the main.
 /// </summary>
 /// <param name="method">The method.</param>
 public void Schedule(RuntimeMethod method)
 {
     _ctx.AppendInstruction(IR.Instruction.CallInstruction, method);
 }
开发者ID:hj1980,项目名称:MOSA-Project,代码行数:8,代码来源:TypeInitializerSchedulerStage.cs


示例20: Compile

 private void Compile(RuntimeMethod method)
 {
     LinkerMethodCompiler methodCompiler = new LinkerMethodCompiler(this.compiler, this.compiler.Pipeline.FindFirst<ICompilationSchedulerStage>(), method, this.InstructionSet);
     methodCompiler.Compile();
 }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:5,代码来源:FakeSystemObjectGenerationStage.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# RuntimePipeline类代码示例发布时间:2022-05-24
下一篇:
C# RuntimeFlavor类代码示例发布时间: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