public void _MethodCacheInfo_SetInternal(MethodCacheInfo MethodCacheInfo, uint PC)
{
Console.Write("Creating function for PC=0x{0:X8}...", PC);
var Stopwatch = new Logger.Stopwatch();
var DynarecFunction = CpuProcessor.DynarecFunctionCompiler.CreateFunction(new InstructionStreamReader(new PspMemoryStream(Memory)), PC);
if (DynarecFunction.EntryPC != PC) throw(new Exception("Unexpected error"));
var AstGenerationTime = Stopwatch.Tick();
DynarecFunction.Delegate(null);
var LinkingTime = Stopwatch.Tick();
Console.WriteLine("({0}): Ast: {1}ms, Link: {2}ms", (DynarecFunction.MaxPC - DynarecFunction.MinPC) / 4, (int)AstGenerationTime.TotalMilliseconds, (int)LinkingTime.TotalMilliseconds);
//DynarecFunction.AstNode = DynarecFunction.AstNode.Optimize(CpuProcessor);
#if DEBUG_FUNCTION_CREATION
CpuProcessor.DebugFunctionCreation = true;
#endif
if (CpuProcessor.DebugFunctionCreation)
{
Console.WriteLine("-------------------------------------");
Console.WriteLine("Created function for PC=0x{0:X8}", PC);
Console.WriteLine("-------------------------------------");
this.DumpRegistersCpu(Console.Out);
Console.WriteLine("-------------------------------------");
Console.WriteLine(DynarecFunction.AstNode.ToCSharpString());
Console.WriteLine("-------------------------------------");
}
MethodCacheInfo.AstTree = DynarecFunction.AstNode;
MethodCacheInfo.StaticField.Value = DynarecFunction.Delegate;
MethodCacheInfo.EntryPC = DynarecFunction.EntryPC;
MethodCacheInfo.MinPC = DynarecFunction.MinPC;
MethodCacheInfo.MaxPC = DynarecFunction.MaxPC;
}