Пример #1
0
        public DynarecFunction CreateFunction(
            IInstructionReader instructionReader, uint pc,
            Action <uint> exploreNewPcCallback = null, bool doDebug = false, bool doLog = false,
            bool checkValidAddress             = true
            )
        {
            switch (pc)
            {
            case SpecialCpu.ReturnFromFunction:
                return(new DynarecFunction()
                {
                    AstNode = new AstNodeStmEmpty(),
                    EntryPc = pc,
                    Name = "SpecialCpu.ReturnFromFunction",
                    InstructionStats = new Dictionary <string, uint>(),
                    Delegate = cpuThreadState =>
                    {
                        if (cpuThreadState == null)
                        {
                            return;
                        }
                        throw new SpecialCpu.ReturnFromFunctionException();
                    }
                });

            default:
                var mipsMethodEmiter         = new MipsMethodEmitter(CpuProcessor, pc, doDebug, doLog);
                var internalFunctionCompiler = new InternalFunctionCompiler(InjectContext, mipsMethodEmiter, this,
                                                                            instructionReader, exploreNewPcCallback, pc, doLog, checkValidAddress: checkValidAddress);
                return(internalFunctionCompiler.CreateFunction());
            }
        }
Пример #2
0
		public DynarecFunction CreateFunction(IInstructionReader InstructionReader, uint PC, Action<uint> ExploreNewPcCallback = null, bool DoDebug = false, bool DoLog = false)
		{
			DynarecFunction DynarecFunction;

			//var Stopwatch = new Logger.Stopwatch();
			//Stopwatch.Tick();
			
			var MipsMethodEmiter = new MipsMethodEmitter(CpuProcessor, PC, DoDebug, DoLog);
			var InternalFunctionCompiler = new InternalFunctionCompiler(CpuProcessor, MipsMethodEmiter, this, InstructionReader, ExploreNewPcCallback, PC, DoLog);
			DynarecFunction = InternalFunctionCompiler.CreateFunction();

			//Stopwatch.Tick();
			//Console.WriteLine("Function at PC 0x{0:X} generated in {1}", PC, Stopwatch);

			return DynarecFunction;
		}
Пример #3
0
 public DynarecFunction CreateFunction(IInstructionReader InstructionReader, uint PC, Action<uint> ExploreNewPcCallback = null, bool DoDebug = false, bool DoLog = false)
 {
     switch (PC)
     {
         case SpecialCpu.ReturnFromFunction:
             return new DynarecFunction()
             {
                 AstNode = new AstNodeStmEmpty(),
                 EntryPC = PC,
                 Name = "SpecialCpu.ReturnFromFunction",
                 InstructionStats = new Dictionary<string,uint>(),
                 Delegate = (CpuThreadState) =>
                 {
                     if (CpuThreadState == null) return;
                     throw (new SpecialCpu.ReturnFromFunctionException());
                 }
             };
         default:
             var MipsMethodEmiter = new MipsMethodEmitter(CpuProcessor, PC, DoDebug, DoLog);
             var InternalFunctionCompiler = new InternalFunctionCompiler(InjectContext, MipsMethodEmiter, this, InstructionReader, ExploreNewPcCallback, PC, DoLog);
             return InternalFunctionCompiler.CreateFunction();
     }
 }
Пример #4
0
 public DynarecFunction CreateFunction(InstructionReader InstructionReader, uint PC)
 {
     var InternalFunctionCompiler = new InternalFunctionCompiler(this, InstructionReader, PC);
     return InternalFunctionCompiler.CreateFunction();
 }