public static VAL Run(Module module, Context context) { CPU cpu = new CPU(module, context); return(Run(cpu, -1)); }
/*** * * 1.func是TIE script $function, 含有函数入口地址$function(...) * 如: * a.class的成员函数 * ret = InvokeFunction(DS, instance, functionAddress, ...); * b.全局函数 * ret = InvokeFunction(DS, new VAL(), functionAddress, ...); * * 2.也可以是Tie script $class, * 如: instance = InvokeFunction(DS, new VAL(), classAddress,...); * 等价于 instance = CreateInstance(DS, classAddress, ...); * * */ /// <summary> /// Invoke method in the data segment /// </summary> /// <param name="memory">data segment</param> /// <param name="instance">instance of Tie class</param> /// <param name="funcEntry">method entry</param> /// <param name="parameters">parameters of method</param> /// <returns></returns> public static VAL InvokeFunction(Memory memory, VAL instance, VAL funcEntry, object[] parameters) { VAL arguments = new VAL(parameters); return(CPU.ExternalUserFuncCall(funcEntry, instance, arguments, new Context(memory))); }