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


C# MosaMethod类代码示例

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


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


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