//const int MaxNumberOfInstructions = 128 * 1024;
            //const int MaxNumberOfInstructions = 60;
            internal InternalFunctionCompiler(DynarecFunctionCompiler DynarecFunctionCompiler, InstructionReader InstructionReader, uint EntryPC)
            {
                //this.DynamicMethod = new DynamicMethod();
                //this.SafeILGenerator = new SafeILGenerator();

                this.DynarecFunctionCompiler = DynarecFunctionCompiler;
                this.InstructionReader = InstructionReader;
                this.EntryPC = EntryPC;
            }
			internal InternalFunctionCompiler(CpuProcessor CpuProcessor, MipsMethodEmitter MipsMethodEmiter, DynarecFunctionCompiler DynarecFunctionCompiler, IInstructionReader InstructionReader, Action<uint> _ExploreNewPcCallback, uint EntryPC, bool DoLog)
			{
				this._ExploreNewPcCallback = _ExploreNewPcCallback;
				this.CpuEmitter = new CpuEmitter(MipsMethodEmiter, InstructionReader, CpuProcessor);
				this.MipsMethodEmitter = MipsMethodEmiter;
				this.GlobalInstructionStats = CpuProcessor.GlobalInstructionStats;
				this.InstructionStats = MipsMethodEmiter.InstructionStats;
				this.NewInstruction = new Dictionary<string, bool>();
				this.DoLog = DoLog;

				this.CpuProcessor = CpuProcessor;
				this.DynarecFunctionCompiler = DynarecFunctionCompiler;
				this.InstructionReader = InstructionReader;
				this.EntryPC = EntryPC;
			}
            internal InternalFunctionCompiler(InjectContext InjectContext, MipsMethodEmitter MipsMethodEmitter, DynarecFunctionCompiler DynarecFunctionCompiler, IInstructionReader InstructionReader, Action<uint> _ExploreNewPcCallback, uint EntryPC, bool DoLog)
            {
                InjectContext.InjectDependencesTo(this);
                this._ExploreNewPcCallback = _ExploreNewPcCallback;
                this.MipsMethodEmitter = MipsMethodEmitter;
                this.CpuEmitter = new CpuEmitter(InjectContext, MipsMethodEmitter, InstructionReader);
                this.GlobalInstructionStats = CpuProcessor.GlobalInstructionStats;
                //this.InstructionStats = MipsMethodEmitter.InstructionStats;
                this.InstructionStats = new Dictionary<string, uint>();
                this.NewInstruction = new Dictionary<string, bool>();
                this.DoLog = DoLog;

                this.DynarecFunctionCompiler = DynarecFunctionCompiler;
                this.InstructionReader = InstructionReader;
                this.EntryPC = EntryPC;

                if (!PspMemory.IsAddressValid(EntryPC))
                {
                    throw (new InvalidOperationException(String.Format("Trying to get invalid function 0x{0:X8}", EntryPC)));
                }
            }
Beispiel #4
0
            internal InternalFunctionCompiler(InjectContext injectContext, MipsMethodEmitter mipsMethodEmitter,
                                              DynarecFunctionCompiler dynarecFunctionCompiler, IInstructionReader instructionReader,
                                              Action <uint> exploreNewPcCallback, uint entryPc, bool doLog, bool checkValidAddress = true)
            {
                injectContext.InjectDependencesTo(this);
                _exploreNewPcCallback   = exploreNewPcCallback;
                _mipsMethodEmitter      = mipsMethodEmitter;
                _cpuEmitter             = new CpuEmitter(injectContext, mipsMethodEmitter, instructionReader);
                _globalInstructionStats = _cpuProcessor.GlobalInstructionStats;
                //this.InstructionStats = MipsMethodEmitter.InstructionStats;
                _instructionStats = new Dictionary <string, uint>();
                _newInstruction   = new Dictionary <string, bool>();
                _doLog            = doLog;

                _dynarecFunctionCompiler = dynarecFunctionCompiler;
                _instructionReader       = instructionReader;
                _entryPc = entryPc;

                if (checkValidAddress && !PspMemory.IsAddressValid(entryPc))
                {
                    throw new InvalidOperationException($"Trying to get invalid function 0x{entryPc:X8}");
                }
            }