public static MonoModJIT MMGetJIT(this Assembly asm) { if (asm == null) { asm = MMGetCallingMethod().DeclaringType.Assembly; } MonoModJIT jit; if (!CacheMonoModJIT.TryGetValue(asm, out jit)) { jit = new MonoModJIT(asm); CacheMonoModJIT[asm] = jit; } return(jit); }
public static object MMRunM(this MethodInfo method, object instance, bool shouldThrow, params object[] args) { MonoModJIT jit = MMGetJIT(method.DeclaringType.Assembly); if (method.DeclaringType.Assembly == jit.PatchedAssembly) { return(null); } object value = jit.GetParsed(method)(instance, args); if (shouldThrow) { throw new MonoModJITPseudoException(value); } else { return(value); } }