Пример #1
0
        protected void LoadAssembly(string filename, bool includeTestComponents, string platform)
        {
            Compiler.CompilerOptions.Architecture = GetArchitecture(cbPlatform.Text);

            var moduleLoader = new MosaModuleLoader();

            if (includeTestComponents)
            {
                moduleLoader.AddPrivatePath(System.IO.Directory.GetCurrentDirectory());
                moduleLoader.LoadModuleFromFile("mscorlib.dll");
                moduleLoader.LoadModuleFromFile("Mosa.Platform.Internal." + platform + ".dll");
                moduleLoader.LoadModuleFromFile("Mosa.Kernel.x86Test.dll");
            }

            moduleLoader.AddPrivatePath(Path.GetDirectoryName(filename));
            moduleLoader.LoadModuleFromFile(filename);

            var metadata = moduleLoader.CreateMetadata();

            Compiler.Load(TypeSystem.Load(metadata));

            UpdateTree();

            Stage = CompileStage.Loaded;
        }
Пример #2
0
        protected void CompileTestCode()
        {
            platform.InitializeSimulation(simAdapter);

            var moduleLoader = new MosaModuleLoader();

            moduleLoader.AddPrivatePath(System.IO.Directory.GetCurrentDirectory());
            moduleLoader.LoadModuleFromFile("mscorlib.dll");
            moduleLoader.LoadModuleFromFile("Mosa.Platform.Internal." + platform.Name + ".dll");
            moduleLoader.LoadModuleFromFile("Mosa.Test.Collection.dll");
            moduleLoader.LoadModuleFromFile("Mosa.Kernel." + platform.Name + "Test.dll");

            compiler.Load(TypeSystem.Load(moduleLoader.CreateMetadata()));

            //compiler.Execute();
            compiler.Execute(Environment.ProcessorCount);

            linker = compiler.Linker as SimLinker;

            //DumpSymbols();
            //simAdapter.SimCPU.Monitor.DebugOutput = true; // DEBUG OPTION

            Run <int>(string.Empty, "Default", "AssemblyInit", true);

            simAdapter.SimCPU.Monitor.DebugOutput = false;             // DEBUG OPTION
        }
Пример #3
0
        public void LoadAssembly(string filename)
        {
            var moduleLoader = new MosaModuleLoader();

            moduleLoader.AddPrivatePath(System.IO.Path.GetDirectoryName(filename));
            moduleLoader.LoadModuleFromFile(filename);

            Compiler.Load(TypeSystem.Load(moduleLoader.CreateMetadata()));

            assembliesView.UpdateTree();
        }
Пример #4
0
        protected void LoadAssembly(string filename, string platform, string includeDirectory = null)
        {
            Compiler.CompilerOptions.Architecture = GetArchitecture(platform);

            var moduleLoader = new MosaModuleLoader();

            if (includeDirectory != null)
            {
                moduleLoader.AddPrivatePath(includeDirectory);
            }

            moduleLoader.AddPrivatePath(Path.GetDirectoryName(filename));
            moduleLoader.LoadModuleFromFile(filename);

            var metadata = moduleLoader.CreateMetadata();

            var typeSystem = TypeSystem.Load(metadata);

            Compiler.Load(typeSystem);
        }
Пример #5
0
        protected void LoadAssembly(string filename, string platform)
        {
            Compiler.CompilerOptions.Architecture = GetArchitecture(cbPlatform.Text);

            var moduleLoader = new MosaModuleLoader();

            moduleLoader.AddPrivatePath(Path.GetDirectoryName(filename));
            moduleLoader.LoadModuleFromFile(filename);

            var metadata = moduleLoader.CreateMetadata();

            Compiler.Load(TypeSystem.Load(metadata));

            UpdateTree();

            Stage = CompileStage.Loaded;
        }
Пример #6
0
        private void CompileTestCode()
        {
            platform.InitializeSimulation(simAdapter);

            var moduleLoader = new MosaModuleLoader();

            moduleLoader.AddPrivatePath(System.IO.Directory.GetCurrentDirectory());
            moduleLoader.LoadModuleFromFile("mscorlib.dll");
            moduleLoader.LoadModuleFromFile("Mosa.Runtime.dll");
            moduleLoader.LoadModuleFromFile("Mosa.Runtime." + platform.Name + ".dll");
            moduleLoader.LoadModuleFromFile("Mosa.Test.Collection.dll");
            moduleLoader.LoadModuleFromFile("Mosa.Kernel." + platform.Name + "Test.dll");

            Compiler.Load(TypeSystem.Load(moduleLoader.CreateMetadata()));

            //var threads = Compiler.CompilerOptions.UseMultipleThreadCompiler ? Environment.ProcessorCount : 1;
            //Compiler.Execute(threads);
            Compiler.Execute(Environment.ProcessorCount);
        }