public static void Compile(CompilerOptions compilerOptions, List<FileInfo> inputFiles, CompilerTrace compilerTrace) { var moduleLoader = new MosaModuleLoader(); moduleLoader.AddPrivatePath(GetInputFileNames(inputFiles)); foreach (string file in GetInputFileNames(inputFiles)) { moduleLoader.LoadModuleFromFile(file); } var typeSystem = TypeSystem.Load(moduleLoader.CreateMetadata()); MosaTypeLayout typeLayout = new MosaTypeLayout(typeSystem, compilerOptions.Architecture.NativePointerSize, compilerOptions.Architecture.NativeAlignment); AotCompiler aot = new AotCompiler(compilerOptions.Architecture, typeSystem, typeLayout, compilerTrace, compilerOptions); var bootStage = compilerOptions.BootStageFactory != null ? compilerOptions.BootStageFactory() : null; aot.Pipeline.Add(new ICompilerStage[] { bootStage, compilerOptions.MethodPipelineExportDirectory != null ? new MethodPipelineExportStage(): null, new PlugStage(), new MethodCompilerSchedulerStage(), new TypeInitializerSchedulerStage(), bootStage, new MethodLookupTableStage(), new MethodExceptionLookupTableStage(), new MetadataStage(), new LinkerFinalizationStage(), compilerOptions.MapFile != null ? new MapFileGenerationStage() : null }); aot.Run(); }
public static void Compile(CompilerOptions compilerOptions, List<FileInfo> inputFiles) { var moduleLoader = new MosaModuleLoader(); moduleLoader.AddPrivatePath(GetInputFileNames(inputFiles)); foreach (string file in GetInputFileNames(inputFiles)) { moduleLoader.LoadModuleFromFile(file); } var typeSystem = TypeSystem.Load(moduleLoader.CreateMetadata()); MosaTypeLayout typeLayout = new MosaTypeLayout(typeSystem, compilerOptions.Architecture.NativePointerSize, compilerOptions.Architecture.NativeAlignment); ConfigurableTraceFilter filter = new ConfigurableTraceFilter(); filter.MethodMatch = MatchType.None; filter.Method = string.Empty; filter.StageMatch = MatchType.Any; filter.TypeMatch = MatchType.Any; filter.ExcludeInternalMethods = false; IInternalTrace internalTrace = new BasicInternalTrace(); internalTrace.TraceFilter = filter; AotCompiler aot = new AotCompiler(compilerOptions.Architecture, typeSystem, typeLayout, internalTrace, compilerOptions); var bootStage = compilerOptions.BootStageFactory != null ? compilerOptions.BootStageFactory() : null; aot.Pipeline.Add(new ICompilerStage[] { bootStage, compilerOptions.MethodPipelineExportDirectory != null ? new MethodPipelineExportStage(): null, new PlugStage(), new MethodCompilerSchedulerStage(), new TypeInitializerSchedulerStage(), bootStage, new TypeLayoutStage(), new MetadataStage(), new ObjectFileLayoutStage(), new LinkerFinalizationStage(), compilerOptions.MapFile != null ? new MapFileGenerationStage() : null }); aot.Run(); }
public void LoadAssembly(string filename) { MosaModuleLoader moduleLoader = new MosaModuleLoader(); moduleLoader.AddPrivatePath(System.IO.Path.GetDirectoryName(filename)); moduleLoader.LoadModuleFromFile(filename); TypeSystem = TypeSystem.Load(moduleLoader.CreateMetadata()); TypeLayout = new MosaTypeLayout(TypeSystem, 4, 4); assembliesView.UpdateTree(); }