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

C# MosaMethod类代码示例

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

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



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

示例1: BaseMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseMethodCompiler" /> class.
        /// </summary>
        /// <param name="compiler">The assembly compiler.</param>
        /// <param name="method">The method to compile by this instance.</param>
        /// <param name="basicBlocks">The basic blocks.</param>
        /// <param name="instructionSet">The instruction set.</param>
        protected BaseMethodCompiler(BaseCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, InstructionSet instructionSet)
        {
            this.Compiler = compiler;
            this.Method = method;
            this.Type = method.DeclaringType;
            this.Scheduler = compiler.CompilationScheduler;
            this.Architecture = compiler.Architecture;
            this.TypeSystem = compiler.TypeSystem;
            this.TypeLayout = Compiler.TypeLayout;
            this.InternalTrace = Compiler.InternalTrace;
            this.Linker = compiler.Linker;
            this.BasicBlocks = basicBlocks ?? new BasicBlocks();
            this.InstructionSet = instructionSet ?? new InstructionSet(256);
            this.Pipeline = new CompilerPipeline();
            this.StackLayout = new StackLayout(Architecture, method.Signature.Parameters.Count + (method.HasThis || method.HasExplicitThis ? 1 : 0));
            this.VirtualRegisters = new VirtualRegisters(Architecture);
            this.LocalVariables = emptyOperandList;
            this.DominanceAnalysis = new DominanceAnalysis(Compiler.CompilerOptions.DominanceAnalysisFactory, this.BasicBlocks);

            EvaluateParameterOperands();

            this.stop = false;

            Debug.Assert(this.Linker != null);
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:32,代码来源:BaseMethodCompiler.cs


示例2: CompilerTrace

 public CompilerTrace(IInternalTrace internalTrace, MosaMethod method, string stage)
     : this(internalTrace)
 {
     this.Stage = stage;
     this.Method = method;
     this.Active = internalTrace.TraceFilter.IsMatch(this.Method, this.Stage);
 }
开发者ID:tea,项目名称:MOSA-Project,代码行数:7,代码来源:CompilerTrace.cs


示例3: TraceLog

 public TraceLog(TraceType type, MosaMethod method, string stage, bool active)
     : this(type)
 {
     this.Stage = stage;
     this.Method = method;
     this.Active = active;
 }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:7,代码来源:TraceLog.cs


示例4: IsMatch

        public bool IsMatch(MosaMethod method, string stage)
        {
            if (!Active)
                return false;

            return IsMatch(method.DeclaringType.Name, method.Name, stage);
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:7,代码来源:TraceFilter.cs


示例5: BaseMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="BaseMethodCompiler" /> class.
        /// </summary>
        /// <param name="compiler">The assembly compiler.</param>
        /// <param name="method">The method to compile by this instance.</param>
        /// <param name="basicBlocks">The basic blocks.</param>
        /// <param name="threadID">The thread identifier.</param>
        protected BaseMethodCompiler(BaseCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, int threadID)
        {
            Compiler = compiler;
            Method = method;
            Type = method.DeclaringType;
            Scheduler = compiler.CompilationScheduler;
            Architecture = compiler.Architecture;
            TypeSystem = compiler.TypeSystem;
            TypeLayout = compiler.TypeLayout;
            Trace = compiler.CompilerTrace;
            Linker = compiler.Linker;
            BasicBlocks = basicBlocks ?? new BasicBlocks();
            Pipeline = new CompilerPipeline();
            StackLayout = new StackLayout(Architecture, method.Signature.Parameters.Count + (method.HasThis || method.HasExplicitThis ? 1 : 0));
            VirtualRegisters = new VirtualRegisters(Architecture);
            LocalVariables = emptyOperandList;
            ThreadID = threadID;
            DominanceAnalysis = new Dominance(Compiler.CompilerOptions.DominanceAnalysisFactory, BasicBlocks);
            PluggedMethod = compiler.PlugSystem.GetPlugMethod(Method);
            stop = false;

            MethodData = compiler.CompilerData.GetCompilerMethodData(Method);
            MethodData.Counters.Clear();

            EvaluateParameterOperands();
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:33,代码来源:BaseMethodCompiler.cs


示例6: TraceLog

 public TraceLog(TraceType type, MosaMethod method, string stage, TraceFilter filter)
     : this(type)
 {
     Stage = stage;
     Method = method;
     Active = filter.IsMatch(Method, Stage);
 }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:7,代码来源:TraceLog.cs


示例7: CalculateStackSizeForParameters

        /// <summary>
        /// Calculates the stack size for parameters.
        /// </summary>
        /// <param name="typeLayout">The type layouts.</param>
        /// <param name="operands">The operands.</param>
        /// <param name="method">The method.</param>
        /// <returns></returns>
        protected static int CalculateStackSizeForParameters(MosaTypeLayout typeLayout, BaseArchitecture architecture, List<Operand> operands, MosaMethod method)
        {
            Debug.Assert((method.Signature.Parameters.Count + (method.HasThis ? 1 : 0) == operands.Count) ||
            (method.DeclaringType.IsDelegate && method.Signature.Parameters.Count == operands.Count), method.FullName);

            int offset = method.Signature.Parameters.Count - operands.Count;
            int result = 0;

            for (int index = operands.Count - 1; index >= 0; index--)
            {
                Operand operand = operands[index];

                int size, alignment;
                architecture.GetTypeRequirements(typeLayout, operand.Type, out size, out alignment);

                var param = (index + offset >= 0) ? method.Signature.Parameters[index + offset] : null;

                if (param != null && operand.IsR8 && param.ParameterType.IsR4)
                {
                    //  adjust for parameter size on stack when method parameter is R4 while the calling variable is R8
                    architecture.GetTypeRequirements(typeLayout, param.ParameterType, out size, out alignment);
                }

                result = (int)Alignment.AlignUp(result, (uint)alignment) + size;
            }

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


示例8: 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>
        /// <param name="basicBlocks">The basic blocks.</param>
        /// <param name="instructionSet">The instruction set.</param>
        public AotMethodCompiler(BaseCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, InstructionSet instructionSet)
            : base(compiler, method, basicBlocks, instructionSet)
        {
            var compilerOptions = compiler.CompilerOptions;

            Pipeline.Add(new IMethodCompilerStage[] {
                new CILDecodingStage(),
                new BasicBlockBuilderStage(),
                new StackSetupStage(),
                new ExceptionPrologueStage(),
                new OperandAssignmentStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),
                new ConvertCompoundMoveStage(),
                (compilerOptions.EnableSSA) ? new PromoteLocalVariablesStage() : null,
                (compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
                (compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
                (compilerOptions.EnableSSA) ? new EnterSSAStage() : null,
                (compilerOptions.EnableSSA && compilerOptions.EnableSSAOptimizations) ? new SSAOptimizations() : null,
                (compilerOptions.EnableSSA) ? new LeaveSSA() : null,
                (compilerOptions.EnableSSA) ? new ConvertCompoundMoveStage() : null,
                new PlatformStubStage(),
                new	PlatformEdgeSplitStage(),
                new GreedyRegisterAllocatorStage(),
                new StackLayoutStage(),
                new EmptyBlockRemovalStage(),
                new BlockOrderingStage(),
                new CodeGenerationStage(),
            });
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:37,代码来源:AotMethodCompiler.cs


示例9: SimMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="SimMethodCompiler" /> class.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        /// <param name="method">The method.</param>
        /// <param name="simAdapter">The sim adapter.</param>
        /// <param name="basicBlocks">The basic blocks.</param>
        /// <param name="instructionSet">The instruction set.</param>
        public SimMethodCompiler(SimCompiler compiler, MosaMethod method, ISimAdapter simAdapter, BasicBlocks basicBlocks, InstructionSet instructionSet)
            : base(compiler, method, basicBlocks, instructionSet)
        {
            var compilerOptions = Compiler.CompilerOptions;

            // Populate the pipeline
            Pipeline.Add(new IMethodCompilerStage[] {
                new CILDecodingStage(),
                new BasicBlockBuilderStage(),
                new StackSetupStage(),
                new ExceptionPrologueStage(),
                new OperandAssignmentStage(),
                //new SingleUseMarkerStage(),
                //new OperandUsageAnalyzerStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),
                new ConvertCompoundMoveStage(),
                //new CheckIROperandCountStage(),
                (compilerOptions.EnableSSA) ? new PromoteLocalVariablesStage() : null,
                (compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
                (compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
                (compilerOptions.EnableSSA) ? new EnterSSAStage() : null,
                (compilerOptions.EnableSSA && compilerOptions.EnableSSAOptimizations) ? new SSAOptimizations() : null,
                (compilerOptions.EnableSSA) ? new LeaveSSA() : null,
                (compilerOptions.EnableSSA) ? new ConvertCompoundMoveStage() : null,
                new PlatformStubStage(),
                //new CheckPlatformOperandCountStage(),
                new	PlatformEdgeSplitStage(),
                new GreedyRegisterAllocatorStage(),
                new StackLayoutStage(),
                new EmptyBlockRemovalStage(),
                new BlockOrderingStage(),
                new SimCodeGeneratorStage(simAdapter),
            });
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:43,代码来源:SimMethodCompiler.cs


示例10: IsScheduled

 public bool IsScheduled(MosaMethod method)
 {
     lock (methods)
     {
         return methods.Contains(method);
     }
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:7,代码来源:CompilationScheduler.cs


示例11: GetPlugMethod

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

            plugMethods.TryGetValue(method, out plug);

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


示例12: CompilerMethodData

        public CompilerMethodData(MosaMethod mosaMethod)
        {
            if (mosaMethod == null)
                throw new ArgumentNullException("mosaMethod");

            Method = mosaMethod;

            this.Calls = new List<MosaMethod>();
            this.CalledBy = new List<MosaMethod>();
            this.CompileCount = 0;
        }
开发者ID:yonglehou,项目名称:MOSA-Project,代码行数:11,代码来源:CompilerMethodData.cs


示例13:

        void ITraceListener.SubmitInstructionTraceInformation(MosaMethod method, string stage, string log)
        {
            if (string.IsNullOrEmpty(MethodPipelineExportDirectory))
                return;

            string filename = (method.FullName + ".txt").Replace("<", "[").Replace(">", "]");

            if (filename.Length > 200)
                filename = filename.Substring(0, 200);

            string fullname = Path.Combine(MethodPipelineExportDirectory, filename);

            File.AppendAllText(fullname, "[" + stage + "]" + Environment.NewLine + Environment.NewLine + log + Environment.NewLine);
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:14,代码来源:MethodPipelineExportStage.cs


示例14: ExplorerMethodCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="ExplorerMethodCompiler" /> class.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        /// <param name="method">The method.</param>
        /// <param name="basicBlocks">The basic blocks.</param>
        /// <param name="threadID">The thread identifier.</param>
        public ExplorerMethodCompiler(ExplorerCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, int threadID)
            : base(compiler, method, basicBlocks, threadID)
        {
            var compilerOptions = Compiler.CompilerOptions;

            // Populate the pipeline
            Pipeline.Add(new IMethodCompilerStage[] {
                new CILDecodingStage(),
                new ExceptionPrologueStage(),
                new OperandAssignmentStage(),
                new StackSetupStage(),

                new CILProtectedRegionStage(),
                new ExceptionStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),
                new UnboxValueTypeStage(),

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

                (compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new SparseConditionalConstantPropagationStage() : null,
                (compilerOptions.EnableOptimizations) ? new IROptimizationStage() : null,

                //(compilerOptions.TwoPassOptimizationStages && compilerOptions.EnableOptimizations && compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new SparseConditionalConstantPropagationStage() : null,
                //(compilerOptions.TwoPassOptimizationStages && compilerOptions.EnableOptimizations && compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new IROptimizationStage() : null,

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

                (compilerOptions.EnableInlinedMethods) ? new InlineEvaluationStage() : null,

                //new StopStage(),

                new PlatformStubStage(),
                new PlatformEdgeSplitStage(),
                new VirtualRegisterRenameStage(),
                new GreedyRegisterAllocatorStage(),
                new StackLayoutStage(),
                new EmptyBlockRemovalStage(),
                new BlockOrderingStage(),
                new CodeGenerationStage(compilerOptions.EmitBinary),
                new GraphVizStage(),
                (compilerOptions.EmitBinary) ? new ProtectedRegionLayoutStage() : null,
                (compilerOptions.EmitBinary) ? new DisassemblyStage() : null
            });
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:56,代码来源:ExplorerMethodCompiler.cs


示例15: GetCompilerMethodData

        public CompilerMethodData GetCompilerMethodData(MosaMethod method)
        {
            lock (compilerMethods)
            {
                CompilerMethodData compilerMethod;

                if (!compilerMethods.TryGetValue(method, out compilerMethod))
                {
                    compilerMethod = new CompilerMethodData(method);
                    compilerMethods.Add(method, compilerMethod);
                }

                return compilerMethod;
            }
        }
开发者ID:pacificIT,项目名称:MOSA-Project,代码行数:15,代码来源:CompilerData.cs


示例16: GetMethodData

        public MethodData GetMethodData(MosaMethod method, bool create)
        {
            lock (methodDataStore)
            {
                MethodData methodData = null;

                if (!methodDataStore.TryGetValue(method, out methodData))
                {
                    if (create)
                    {
                        methodData = new MethodData();
                        methodDataStore.Add(method, methodData);
                    }
                }
                return methodData;
            }
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:17,代码来源:MethodStore.cs


示例17: Run

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

            if (internalLog.TraceListener == null)
                return;

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

            StringBuilder text = new StringBuilder();

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

            if (basicBlocks.Count > 0)
            {
                foreach (BasicBlock block in basicBlocks)
                {
                    text.AppendFormat("Block #{0} - Label L_{1:X4}", block.Sequence, 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();
                }
            }
            else
            {
                LogInstructions(text, new Context(instructionSet, 0));
            }

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


示例18: 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>
        /// <param name="basicBlocks">The basic blocks.</param>
        /// <param name="threadID">The thread identifier.</param>
        public AotMethodCompiler(BaseCompiler compiler, MosaMethod method, BasicBlocks basicBlocks, int threadID)
            : base(compiler, method, basicBlocks, threadID)
        {
            var compilerOptions = compiler.CompilerOptions;

            // Populate the pipeline
            Pipeline.Add(new IMethodCompilerStage[] {
                new CILDecodingStage(),
                new ExceptionPrologueStage(),
                new OperandAssignmentStage(),
                new StackSetupStage(),
                new CILProtectedRegionStage(),
                new ExceptionStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),
                new ConvertCompoundStage(),
                new UnboxValueTypeStage(),
                (compilerOptions.EnableInlinedMethods) ? new InlineStage() : null,
                (compilerOptions.EnableVariablePromotion) ? new PromoteTempVariablesStage() : null,
                (compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
                (compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
                (compilerOptions.EnableSSA) ? new EnterSSAStage() : null,
                (compilerOptions.EnableOptimizations && compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new SparseConditionalConstantPropagationStage() : null,
                (compilerOptions.EnableOptimizations) ? new IROptimizationStage() : null,

                (compilerOptions.TwoPassOptimizationStages && compilerOptions.EnableOptimizations && compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new SparseConditionalConstantPropagationStage() : null,
                (compilerOptions.TwoPassOptimizationStages && compilerOptions.EnableOptimizations && compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new IROptimizationStage() : null,

                (compilerOptions.EnableSSA) ? new LeaveSSA() : null,
                new IRCleanupStage(),
                (compilerOptions.EnableInlinedMethods) ? new InlineEvaluationStage() : null,
                new PlatformStubStage(),
                new PlatformEdgeSplitStage(),
                new GreedyRegisterAllocatorStage(),
                new StackLayoutStage(),
                new EmptyBlockRemovalStage(),
                new BlockOrderingStage(),
                new CodeGenerationStage(),
                new ProtectedRegionLayoutStage(),
            });
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:48,代码来源:AotMethodCompiler.cs


示例19: Run

        public static void Run(CompilerTrace compilerTrace, string stage, MosaMethod method, BasicBlocks basicBlocks)
        {
            if (compilerTrace == null)
                return;

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

            var traceLog = new TraceLog(TraceType.InstructionList, method, stage, true);

            traceLog.Log(String.Format("IR representation of method {0} after stage {1}:", method.FullName, stage));
            traceLog.Log();

            if (basicBlocks.Count > 0)
            {
                foreach (var block in basicBlocks)
                {
                    traceLog.Log(String.Format("Block #{0} - Label L_{1:X4}", block.Sequence, block.Label)
                        + (basicBlocks.IsHeadBlock(block) ? " [Header]" : string.Empty));

                    traceLog.Log("  Prev: " + ListBlocks(block.PreviousBlocks));

                    LogInstructions(traceLog, block.First);

                    traceLog.Log("  Next: " + ListBlocks(block.NextBlocks));

                    traceLog.Log();
                }
            }
            else
            {
                traceLog.Log("No instructions.");
            }

            compilerTrace.NewTraceLog(traceLog);
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:36,代码来源:InstructionLogger.cs


示例20: TrackMethodInvoked

 public void TrackMethodInvoked(MosaMethod method)
 {
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:3,代码来源:CompilationScheduler.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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