Пример #1
0
        protected void LoadAssembly(string filename)
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.AddPrivatePath(System.IO.Path.GetDirectoryName(filename));

            metadataModule = assemblyLoader.LoadModule(filename);

            UpdateTree();
        }
Пример #2
0
        static void Main(string[] args)
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.AddPrivatePath(@"X:\MonoTest\bin\");

            assemblyLoader.LoadModule(@"X:\MonoTest\bin\Mosa.HelloWorld.exe");

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

            return;
        }
Пример #3
0
        protected void LoadAssembly(string filename)
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.AddPrivatePath(System.IO.Path.GetDirectoryName(filename));

            assemblyLoader.LoadModule(filename);

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

            typeLayout = new TypeLayout(typeSystem, 4, 4);

            UpdateTree();
        }
Пример #4
0
        private void RunMosaCompiler(CompilerHelperSettings settings, string assemblyFile)
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.InitializePrivatePaths(settings.References);

            assemblyLoader.LoadModule(assemblyFile);

            foreach (string file in settings.References)
            {
                assemblyLoader.LoadModule(file);
            }

            typeSystem = new TypeSystem();
            typeSystem.LoadModules(assemblyLoader.Modules);
            RunMosaCompiler();
        }
Пример #5
0
        private void Compile()
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.InitializePrivatePaths(this.GetInputFileNames());

            ITypeSystem typeSystem = new DefaultTypeSystem(assemblyLoader);
            typeSystem.LoadModules(this.GetInputFileNames());

            // Create the compiler
            using (AotCompiler aot = new AotCompiler(this.architectureSelector.Architecture, typeSystem))
            {
                aot.Pipeline.AddRange(new IAssemblyCompilerStage[]
                    {
                        this.bootFormatStage,
                        new InterruptBuilderStage(),
                        new AssemblyCompilationStage(),
                        //new FakeSystemObjectGenerationStage(),
                        new MethodCompilerSchedulerStage(),
                        new TypeInitializers.TypeInitializerSchedulerStage(),
                        this.bootFormatStage,
                        new Metadata.MetadataBuilderStage(),
                        new CilHeaderBuilderStage(),
                        new ObjectFileLayoutStage(),
                        this.linkerStage,
                        this.mapFileWrapper
                    });

                aot.Run();
            }
        }
Пример #6
0
        private void Compile()
        {
            IAssemblyLoader assemblyLoader = new AssemblyLoader();
            assemblyLoader.InitializePrivatePaths(this.GetInputFileNames());

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

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

            int nativePointerSize;
            int nativePointerAlignment;

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

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

            // Create the compiler
            using (AotCompiler aot = new AotCompiler(this.architectureSelector.Architecture, typeSystem, typeLayout))
            {
                aot.Pipeline.AddRange(new IAssemblyCompilerStage[]
                    {
                        this.bootFormatStage,
                        new InterruptBuilderStage(),
                        new AssemblyCompilationStage(),
                        //new FakeSystemObjectGenerationStage(),
                        new MethodCompilerSchedulerStage(),
                        new TypeInitializers.TypeInitializerSchedulerStage(),
                        this.bootFormatStage,
                        new CilHeaderBuilderStage(),
                        new ObjectFileLayoutStage(),
                        this.linkerStage,
                        this.mapFileWrapper
                    });

                aot.Run();
            }
        }