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

            metadataModule = assemblyLoader.LoadModule(filename);

            UpdateTree();
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 5
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();
            }
        }