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


C# MosaTypeSystem.TypeSystem类代码示例

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


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

示例1: Compile

        /// <summary>
        /// Compiles the specified type system.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="compilerTrace">The compiler trace.</param>
        /// <param name="compilerOptions">The compiler options.</param>
        /// <param name="architecture">The architecture.</param>
        /// <param name="simAdapter">The sim adapter.</param>
        /// <param name="linker">The linker.</param>
        /// <returns></returns>
        public static SimCompiler Compile(TypeSystem typeSystem, MosaTypeLayout typeLayout, CompilerTrace compilerTrace, CompilerOptions compilerOptions, BaseArchitecture architecture, ISimAdapter simAdapter, BaseLinker linker)
        {
            var compiler = new SimCompiler(architecture, typeSystem, typeLayout, linker, compilerOptions, compilerTrace, simAdapter);

            compiler.Compile();

            return compiler;
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:19,代码来源:SimCompiler.cs

示例2: MosaTypeLayout

        /// <summary>
        /// Initializes a new instance of the <see cref="MosaTypeLayout" /> class.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="nativePointerSize">Size of the native pointer.</param>
        /// <param name="nativePointerAlignment">The native pointer alignment.</param>
        public MosaTypeLayout(TypeSystem typeSystem, int nativePointerSize, int nativePointerAlignment)
        {
            Debug.Assert(nativePointerSize == 4 || nativePointerSize == 8);

            NativePointerAlignment = nativePointerAlignment;
            NativePointerSize = nativePointerSize;
            TypeSystem = typeSystem;

            ResolveLayouts();
        }
开发者ID:tgiphil,项目名称:MOSA-Project,代码行数:16,代码来源:MosaTypeLayout.cs

示例3: Compile

        /// <summary>
        /// Compiles the specified type system.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="internalTrace">The internal trace.</param>
        /// <param name="enabledSSA">if set to <c>true</c> [enabled ssa].</param>
        /// <param name="architecture">The architecture.</param>
        /// <param name="simAdapter">The sim adapter.</param>
        /// <param name="linker">The linker.</param>
        /// <returns></returns>
        public static SimCompiler Compile(TypeSystem typeSystem, MosaTypeLayout typeLayout, IInternalTrace internalTrace, bool enabledSSA, BaseArchitecture architecture, ISimAdapter simAdapter, ILinker linker)
        {
            CompilerOptions compilerOptions = new CompilerOptions();
            compilerOptions.EnableSSA = enabledSSA;
            compilerOptions.EnableSSAOptimizations = enabledSSA;

            SimCompiler compiler = new SimCompiler(architecture, typeSystem, typeLayout, linker, compilerOptions, internalTrace, simAdapter);

            compiler.Compile();

            return compiler;
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:23,代码来源:SimCompiler.cs

示例4: CompilationScheduler

        public CompilationScheduler(TypeSystem typeSystem, bool compileAllMethods)
        {
            this.typeSystem = typeSystem;
            this.compileAllMethods = compileAllMethods;

            if (compileAllMethods)
            {
                // forces all types to get compiled
                foreach (MosaType type in typeSystem.AllTypes)
                {
                    CompileType(type);
                }
            }
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:14,代码来源:CompilationScheduler.cs

示例5: Compile

        /// <summary>
        /// Compiles the specified type system.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="compilerTrace">The compiler trace.</param>
        /// <param name="platform">The platform.</param>
        /// <param name="enabledSSA">if set to <c>true</c> [enabled ssa].</param>
        /// <param name="enableOptimizations">if set to <c>true</c> [enable ssa optimizations].</param>
        /// <param name="emitBinary">if set to <c>true</c> [emit binary].</param>
        public static void Compile(TypeSystem typeSystem, MosaTypeLayout typeLayout, CompilerTrace compilerTrace, string platform, CompilerOptions compilerOptions, bool emitBinary)
        {
            BaseArchitecture architecture;

            switch (platform.ToLower())
            {
                case "x86": architecture = Mosa.Platform.x86.Architecture.CreateArchitecture(Mosa.Platform.x86.ArchitectureFeatureFlags.AutoDetect); break;
                case "armv6": architecture = Mosa.Platform.ARMv6.Architecture.CreateArchitecture(Mosa.Platform.ARMv6.ArchitectureFeatureFlags.AutoDetect); break;
                //case "avr32": architecture = Mosa.Platform.AVR32.Architecture.CreateArchitecture(Mosa.Platform.AVR32.ArchitectureFeatureFlags.AutoDetect); break;
                default:
                    architecture = Mosa.Platform.x86.Architecture.CreateArchitecture(Mosa.Platform.x86.ArchitectureFeatureFlags.AutoDetect); break;
            }

            var compiler = new ExplorerCompiler(architecture, typeSystem, typeLayout, compilerTrace, compilerOptions, emitBinary);

            compiler.Compile();
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:27,代码来源:ExplorerCompiler.cs

示例6: ExplorerCompiler

        /// <summary>
        /// Prevents a default instance of the <see cref="ExplorerCompiler" /> class from being created.
        /// </summary>
        /// <param name="architecture">The compiler target architecture.</param>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="compilerTrace">The internal trace.</param>
        /// <param name="compilerOptions">The compiler options.</param>
        public ExplorerCompiler(BaseArchitecture architecture, TypeSystem typeSystem, MosaTypeLayout typeLayout, CompilerTrace compilerTrace, CompilerOptions compilerOptions, bool emitBinary)
            : base(architecture, typeSystem, typeLayout, new CompilationScheduler(typeSystem, true), compilerTrace, new ExplorerLinker(), compilerOptions)
        {
            this.emitBinary = emitBinary;

            // Build the assembly compiler pipeline
            Pipeline.Add(new ICompilerStage[] {
                new PlugStage(),
                new MethodCompilerSchedulerStage(),
                new TypeInitializerSchedulerStage(),
                new MethodLookupTableStage(),
                new MethodExceptionLookupTableStage(),
                new MetadataStage(),
            });

            architecture.ExtendCompilerPipeline(Pipeline);
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:25,代码来源:ExplorerCompiler.cs

示例7: SimCompiler

        /// <summary>
        /// Prevents a default instance of the <see cref="SimCompiler" /> class from being created.
        /// </summary>
        /// <param name="architecture">The compiler target architecture.</param>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="linker">The linker.</param>
        /// <param name="compilerOptions">The compiler options.</param>
        /// <param name="internalTrace">The internal trace.</param>
        /// <param name="simAdapter">The sim adapter.</param>
        public SimCompiler(BaseArchitecture architecture, TypeSystem typeSystem, MosaTypeLayout typeLayout, ILinker linker, CompilerOptions compilerOptions, IInternalTrace internalTrace, ISimAdapter simAdapter)
            : base(architecture, typeSystem, typeLayout, new CompilationScheduler(typeSystem, true), internalTrace, linker, compilerOptions)
        {
            this.simAdapter = simAdapter;

            // Build the assembly compiler pipeline
            Pipeline.Add(new ICompilerStage[] {
                new PlugStage(),
                new MethodCompilerSchedulerStage(),
                new TypeInitializerSchedulerStage(),
                new SimPowerUpStage(),
                new TypeLayoutStage(),
                new MetadataStage(),
                new LinkerFinalizationStage(),
            });

            architecture.ExtendCompilerPipeline(Pipeline);
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:28,代码来源:SimCompiler.cs

示例8: BaseCompiler

        /// <summary>
        /// Initializes a new compiler instance.
        /// </summary>
        /// <param name="architecture">The compiler target architecture.</param>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="compilationScheduler">The compilation scheduler.</param>
        /// <param name="compilerTrace">The compiler trace.</param>
        /// <param name="linker">The linker.</param>
        /// <param name="compilerOptions">The compiler options.</param>
        /// <exception cref="System.ArgumentNullException">@Architecture</exception>
        protected BaseCompiler(BaseArchitecture architecture, TypeSystem typeSystem, MosaTypeLayout typeLayout, ICompilationScheduler compilationScheduler, CompilerTrace compilerTrace, BaseLinker linker, CompilerOptions compilerOptions)
        {
            if (architecture == null)
                throw new ArgumentNullException(@"Architecture");

            Pipeline = new CompilerPipeline();
            Architecture = architecture;
            TypeSystem = typeSystem;
            TypeLayout = typeLayout;
            CompilerTrace = compilerTrace;
            CompilerOptions = compilerOptions;
            Counters = new Counters();
            CompilationScheduler = compilationScheduler;
            PlugSystem = new PlugSystem();
            Linker = linker;

            if (Linker == null)
            {
                Linker = compilerOptions.LinkerFactory();
                Linker.Initialize(compilerOptions.BaseAddress, architecture.Endianness, architecture.ElfMachineType);
            }

            // Create new dictionary
            IntrinsicTypes = new Dictionary<string, Type>();

            // Get all the classes that implement the IIntrinsicInternalMethod interface
            IEnumerable<Type> types = AppDomain.CurrentDomain.GetAssemblies()
                .SelectMany(s => s.GetTypes())
                .Where(p => typeof(IIntrinsicInternalMethod).IsAssignableFrom(p) && p.IsClass);

            // Iterate through all the found types
            foreach (var t in types)
            {
                // Now get all the ReplacementTarget attributes
                var attributes = (ReplacementTargetAttribute[])t.GetCustomAttributes(typeof(ReplacementTargetAttribute), true);
                for (int i = 0; i < attributes.Length; i++)
                {
                    // Finally add the dictionary entry mapping the target string and the type
                    IntrinsicTypes.Add(attributes[i].Target, t);
                }
            }

            PlatformInternalRuntimeType = GetPlatformInternalRuntimeType();
        }
开发者ID:Boddlnagg,项目名称:MOSA-Project,代码行数:55,代码来源:BaseCompiler.cs

示例9: Compile

        /// <summary>
        /// Compiles the specified type system.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="internalTrace">The internal trace.</param>
        /// <param name="platform">The platform.</param>
        /// <param name="enabledSSA">if set to <c>true</c> [enabled ssa].</param>
        /// <param name="emitBinary">if set to <c>true</c> [emit binary].</param>
        public static void Compile(TypeSystem typeSystem, MosaTypeLayout typeLayout, IInternalTrace internalTrace, string platform, bool enabledSSA, bool emitBinary)
        {
            BaseArchitecture architecture;

            switch (platform.ToLower())
            {
                case "x86": architecture = Mosa.Platform.x86.Architecture.CreateArchitecture(Mosa.Platform.x86.ArchitectureFeatureFlags.AutoDetect); break;
                case "armv6": architecture = Mosa.Platform.ARMv6.Architecture.CreateArchitecture(Mosa.Platform.ARMv6.ArchitectureFeatureFlags.AutoDetect); break;
                //case "avr32": architecture = Mosa.Platform.AVR32.Architecture.CreateArchitecture(Mosa.Platform.AVR32.ArchitectureFeatureFlags.AutoDetect); break;
                default:
                    architecture = Mosa.Platform.x86.Architecture.CreateArchitecture(Mosa.Platform.x86.ArchitectureFeatureFlags.AutoDetect); break;
            }

            CompilerOptions compilerOptions = new CompilerOptions();
            compilerOptions.EnableSSA = enabledSSA;
            compilerOptions.EnableSSAOptimizations = enabledSSA && enabledSSA;

            ExplorerCompiler compiler = new ExplorerCompiler(architecture, typeSystem, typeLayout, internalTrace, compilerOptions, emitBinary);

            compiler.Compile();
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:30,代码来源:ExplorerCompiler.cs

示例10: BaseCompiler

        /// <summary>
        /// Initializes a new compiler instance.
        /// </summary>
        /// <param name="architecture">The compiler target architecture.</param>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="typeLayout">The type layout.</param>
        /// <param name="compilationScheduler">The compilation scheduler.</param>
        /// <param name="internalTrace">The internal trace.</param>
        /// <param name="compilerOptions">The compiler options.</param>
        protected BaseCompiler(BaseArchitecture architecture, TypeSystem typeSystem, MosaTypeLayout typeLayout, ICompilationScheduler compilationScheduler, IInternalTrace internalTrace, ILinker linker, CompilerOptions compilerOptions)
        {
            if (architecture == null)
                throw new ArgumentNullException(@"Architecture");

            Pipeline = new CompilerPipeline();
            Architecture = architecture;
            TypeSystem = typeSystem;
            TypeLayout = typeLayout;
            InternalTrace = internalTrace;
            CompilerOptions = compilerOptions;
            Counters = new Counters();
            CompilationScheduler = compilationScheduler;
            PlugSystem = new PlugSystem();
            Linker = linker;

            if (Linker == null)
            {
                Linker = compilerOptions.LinkerFactory();
                Linker.Initialize(compilerOptions.OutputFile, architecture.Endianness, architecture.ElfMachineType);
            }
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:31,代码来源:BaseCompiler.cs

示例11: GetNull

 /// <summary>
 /// Gets the null constant <see cref="Operand"/>.
 /// </summary>
 /// <returns></returns>
 public static Operand GetNull(TypeSystem typeSystem)
 {
     var operand = new Operand(typeSystem.BuiltIn.Object);
     operand.IsNull = true;
     operand.IsConstant = true;
     return operand;
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:11,代码来源:Operand.cs

示例12: CreateSymbolFromMethod

 /// <summary>
 /// Creates a new symbol <see cref="Operand" /> for the given symbol name.
 /// </summary>
 /// <param name="typeSystem">The type system.</param>
 /// <param name="method">The method.</param>
 /// <returns></returns>
 public static Operand CreateSymbolFromMethod(TypeSystem typeSystem, MosaMethod method)
 {
     var operand = CreateUnmanagedSymbolPointer(typeSystem, method.FullName);
     operand.Method = method;
     return operand;
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:12,代码来源:Operand.cs

示例13: CreateUnmanagedSymbolPointer

 /// <summary>
 /// Creates the symbol.
 /// </summary>
 /// <param name="typeSystem">The type system.</param>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public static Operand CreateUnmanagedSymbolPointer(TypeSystem typeSystem, string name)
 {
     var operand = new Operand(typeSystem.BuiltIn.Pointer);
     operand.IsSymbol = true;
     operand.Name = name;
     return operand;
 }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:13,代码来源:Operand.cs

示例14: Initialize

        public void Initialize(MosaCompiler compiler)
        {
            if (compiler == null)
                throw new ArgumentNullException(@"compiler");

            Compiler = compiler;

            Architecture = Compiler.CompilerOptions.Architecture;
            TypeSystem = Compiler.TypeSystem;
            TypeLayout = Compiler.TypeLayout;
            CompilerTrace = Compiler.CompilerTrace;
            CompilerOptions = Compiler.CompilerOptions;
            CompilationScheduler = Compiler.CompilationScheduler;
            Linker = compiler.Linker;

            PreCompilePipeline = new CompilerPipeline();
            PostCompilePipeline = new CompilerPipeline();
            GlobalCounters = new Counters();
            PlugSystem = new PlugSystem();
            CompilerData = new CompilerData();

            // Create new dictionary
            IntrinsicTypes = new Dictionary<string, Type>();

            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (type.IsClass && typeof(IIntrinsicInternalMethod).IsAssignableFrom(type))
                {
                    // Now get all the ReplacementTarget attributes
                    var attributes = (ReplacementTargetAttribute[])type.GetCustomAttributes(typeof(ReplacementTargetAttribute), true);
                    for (int i = 0; i < attributes.Length; i++)
                    {
                        // Finally add the dictionary entry mapping the target string and the type
                        IntrinsicTypes.Add(attributes[i].Target, type);
                    }
                }
            }

            PlatformInternalRuntimeType = GetPlatformInternalRuntimeType();
            InternalRuntimeType = GeInternalRuntimeType();

            // Extended Setup
            ExtendCompilerSetup();

            // Build the default pre-compiler pipeline
            Architecture.ExtendPreCompilerPipeline(PreCompilePipeline);

            // Build the default post-compiler pipeline
            Architecture.ExtendPostCompilerPipeline(PostCompilePipeline);
        }
开发者ID:Profi-Concept,项目名称:MOSA-Project,代码行数:50,代码来源:BaseCompiler.cs

示例15: CreateStringSymbol

        /// <summary>
        /// Creates the string symbol with data.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="name">The name.</param>
        /// <param name="data">The string data.</param>
        /// <returns></returns>
        public static Operand CreateStringSymbol(TypeSystem typeSystem, string name, string data)
        {
            Debug.Assert(data != null);

            var operand = new Operand(typeSystem.BuiltIn.String);
            operand.IsSymbol = true;
            operand.Name = name;
            operand.StringData = data;
            return operand;
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:17,代码来源:Operand.cs


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