Beispiel #1
0
        public void StartSimulator(string platform)
        {
            if (TypeSystem == null)
                return;

            Status = "Compiling...";

            Architecture = GetArchitecture(platform);
            var simAdapter = GetSimAdaptor(platform);
            Linker = new SimLinker(simAdapter);

            compileStartTime = DateTime.Now;

            var compilerOptions = new CompilerOptions();

            compilerOptions.EnableSSA = true;
            compilerOptions.EnableOptimizations = true;
            compilerOptions.EnablePromoteTemporaryVariablesOptimization = true;
            compilerOptions.EnableSparseConditionalConstantPropagation = true;

            SimCompiler.Compile(TypeSystem, TypeLayout, InternalTrace, compilerOptions, Architecture, simAdapter, Linker);

            SimCPU = simAdapter.SimCPU;

            SimCPU.Monitor.BreakAtTick = 1;
            SimCPU.Monitor.BreakOnException = true;
            SimCPU.Monitor.OnStateUpdate = UpdateSimState;
            SimCPU.Reset();

            Display32 = SimCPU.GetState().NativeRegisterSize == 32;

            SimCPU.Monitor.OnExecutionStepCompleted(true);

            Status = "Compiled.";

            symbolView.CreateEntries();
        }
Beispiel #2
0
        private void Compile()
        {
            var simAdapter = GetSimAdaptor("x86");

            compileStartTime = DateTime.Now;

            Compiler.CompilerOptions.EnableSSA = false;
            Compiler.CompilerOptions.EnableOptimizations = false;
            Compiler.CompilerOptions.EnableVariablePromotion = false;
            Compiler.CompilerOptions.EnableSparseConditionalConstantPropagation = false;
            Compiler.CompilerOptions.EnableInlinedMethods = false;

            Compiler.CompilerOptions.LinkerFactory = delegate { return new SimLinker(simAdapter); };
            Compiler.CompilerFactory = delegate { return new SimCompiler(simAdapter); };

            Compiler.Execute(Environment.ProcessorCount);

            SimCPU = simAdapter.SimCPU;

            SimCPU.Monitor.BreakAtTick = 1;
            SimCPU.Monitor.BreakOnException = true;
            SimCPU.Monitor.OnStateUpdate = UpdateSimState;
            SimCPU.Reset();

            Display32 = SimCPU.GetState().NativeRegisterSize == 32;
        }