Exemple #1
0
        protected void LoadAssembly(string filename)
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.AddPrivatePath(System.IO.Path.GetDirectoryName(filename));

            metadataModule = assemblyLoader.LoadModule(filename);

            UpdateTree();
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Verify"/> class.
        /// </summary>
        /// <param name="options">The options.</param>
        public Verify(VerificationOptions options)
        {
            this.options = options;
            assemblyLoader = new AssemblyLoader();

            assemblyLoader.AddPrivatePath(Path.GetDirectoryName(options.InputFile));
            assemblyLoader.InitializePrivatePaths(options.Paths);
            assemblyLoader.LoadModule(options.InputFile);

            HasError = false;
        }
        public static void Compile(CompilerOptions compilerOptions, List<FileInfo> inputFiles)
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.InitializePrivatePaths(GetInputFileNames(inputFiles));

            foreach (string file in GetInputFileNames(inputFiles))
            {
                assemblyLoader.LoadModule(file);
            }

            ITypeSystem typeSystem = new TypeSystem();
            typeSystem.LoadModules(assemblyLoader.Modules);

            int nativePointerSize;
            int nativePointerAlignment;

            compilerOptions.Architecture.GetTypeRequirements(BuiltInSigType.IntPtr, out nativePointerSize, out nativePointerAlignment);

            TypeLayout typeLayout = new TypeLayout(typeSystem, nativePointerSize, nativePointerAlignment);

            IInternalTrace internalLog = new BasicInternalTrace();

            using (AotAssemblyCompiler aot = new AotAssemblyCompiler(compilerOptions.Architecture, compilerOptions.Linker, typeSystem, typeLayout, internalLog, compilerOptions))
            {
                aot.Pipeline.AddRange(new IAssemblyCompilerStage[]
                {
                    compilerOptions.BootCompilerStage,
                    new MethodPipelineExportStage(),
                    new DelegateTypePatchStage(),
                    new PlugStage(),
                    new AssemblyMemberCompilationSchedulerStage(),
                    new MethodCompilerSchedulerStage(),
                    new TypeInitializerSchedulerStage(),
                    new TypeLayoutStage(),
                    new MetadataStage(),
                    compilerOptions.BootCompilerStage,
                    new ObjectFileLayoutStage(),
                    (IAssemblyCompilerStage)compilerOptions.Linker,
                    compilerOptions.MapFile != null ? new MapFileGenerationStage() : null
                });

                aot.Run();
            }
        }