public MethodCacheInfo GetForPC(uint PC)
{
if (MethodMapping.ContainsKey(PC))
{
return MethodMapping[PC];
}
else
{
var DelegateGeneratorForPC = GeneratorILInstance.GenerateDelegate<Action<CpuThreadState>>("MethodCache.DynamicCreateNewFunction", ast.Statements(
ast.Statement(ast.CallInstance(ast.CpuThreadState, (Action<MethodCacheInfo, uint>)CpuThreadState.Methods._MethodCacheInfo_SetInternal, ast.GetMethodCacheInfoAtPC(PC), PC)),
ast.Statement(ast.TailCall(ast.CallInstance(ast.GetMethodCacheInfoAtPC(PC), (Action<CpuThreadState>)MethodCacheInfo.Methods.CallDelegate, ast.CpuThreadState))),
ast.Return()
));
return MethodMapping[PC] = new MethodCacheInfo(this, DelegateGeneratorForPC, PC);
}
}