def _prepare_call(self, resulttypeinfo, calldescr, args_i, args_r, args_f): assert isinstance(calldescr, Descr) assert calldescr.typeinfo in resulttypeinfo if args_i is not None: for x in args_i: llimpl.do_call_pushint(x) if args_r is not None: for x in args_r: llimpl.do_call_pushptr(x) if args_f is not None: for x in args_f: llimpl.do_call_pushfloat(x)
def do_call(self, args, calldescr): assert isinstance(calldescr, Descr) func = args[0].getint() for arg in args[1:]: if arg.type == REF: llimpl.do_call_pushptr(arg.getref_base()) elif arg.type == FLOAT: llimpl.do_call_pushfloat(arg.getfloat()) else: llimpl.do_call_pushint(arg.getint()) if calldescr.typeinfo == REF: return history.BoxPtr(llimpl.do_call_ptr(func, self.memo_cast)) elif calldescr.typeinfo == INT: return history.BoxInt(llimpl.do_call_int(func, self.memo_cast)) elif calldescr.typeinfo == FLOAT: return history.BoxFloat(llimpl.do_call_float(func, self.memo_cast)) elif calldescr.typeinfo == 'v': # void llimpl.do_call_void(func, self.memo_cast) else: raise NotImplementedError