예제 #1
0
        public void Compile(bool skipFinalization = false)
        {
            Setup();

            if (!CompilerSettings.MethodScanner)
            {
                ScheduleAll();
            }

            lock (_lock)
            {
                if (Stage != CompileStage.Ready)
                {
                    return;
                }

                Stage = CompileStage.Executing;
            }

            var maxThreads = CompilerSettings.MaxThreads != 0 ? CompilerSettings.MaxThreads : (int)(Environment.ProcessorCount * 1.2);

            Compiler.ExecuteCompile(maxThreads);

            lock (_lock)
            {
                Stage = CompileStage.Ready;
            }

            if (!skipFinalization)
            {
                Finalization();
            }
        }
예제 #2
0
        public void Compile(bool skipFinalization = false)
        {
            Setup();

            if (!CompilerSettings.MethodScanner)
            {
                ScheduleAll();
            }

            lock (_lock)
            {
                if (Stage != CompileStage.Ready)
                {
                    return;
                }

                Stage = CompileStage.Executing;
            }

            Compiler.ExecuteCompile();

            lock (_lock)
            {
                Stage = CompileStage.Ready;
            }

            if (!skipFinalization)
            {
                Finalization();
            }
        }
예제 #3
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;
        }
예제 #4
0
 private void PreCompile()
 {
     if (Stage == CompileStage.Loaded)
     {
         SetCompilerOptions();
         Compiler.Initialize();
         Compiler.PreCompile();
         Stage = CompileStage.PreCompiled;
     }
 }
예제 #5
0
        public void LoadAssembly(string filename, string includeDirectory = null)
        {
            LoadAssembly(filename, cbPlatform.Text, includeDirectory);

            CreateTree();

            Stage = CompileStage.Loaded;

            methodStore.Clear();

            SetStatus("Assemblies Loaded!");
        }
예제 #6
0
        public void Initialize()
        {
            lock (_lock)
            {
                if (Stage != CompileStage.Loaded)
                {
                    return;
                }

                Compiler = new Compiler(this);

                Stage = CompileStage.Initialized;
            }
        }
예제 #7
0
        public void Load(TypeSystem typeSystem)
        {
            lock (_lock)
            {
                TypeSystem = typeSystem;

                Platform   = PlatformRegistry.GetPlatform(CompilerSettings.Platform);
                TypeLayout = new MosaTypeLayout(typeSystem, Platform.NativePointerSize, Platform.NativeAlignment);

                Compiler = null;

                Stage = CompileStage.Loaded;
            }
        }
예제 #8
0
        public void Finalization()
        {
            lock (_lock)
            {
                if (Stage != CompileStage.Ready)
                {
                    return;
                }

                Compiler.Finalization();

                Stage = CompileStage.Completed;
            }
        }
예제 #9
0
        public void Setup()
        {
            Initialize();

            lock (_lock)
            {
                if (Stage != CompileStage.Initialized)
                {
                    return;
                }

                Compiler.Setup();

                Stage = CompileStage.Ready;
            }
        }
예제 #10
0
        private void CompileCompleted()
        {
            toolStrip1.Enabled = true;

            Stage = CompileStage.Compiled;

            SetStatus("Compiled!");

            tabControl1.SelectedTab = tbStages;

            rbLog.Text            = compileLog.ToString();
            rbErrors.Text         = errorLog.ToString();
            rbGlobalCounters.Text = counterLog.ToString();
            rbException.Text      = exceptionLog.ToString();

            UpdateTree();
        }
예제 #11
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;
        }
예제 #12
0
 public CompileError(CompileStage stage, Position position, string message)
 {
     Stage    = stage;
     Position = position;
     Message  = message;
 }
예제 #13
0
 public CompileError(CompileStage stage, Position position, string message)
 {
     Stage = stage;
     Position = position;
     Message = message;
 }