def call(self, opname, hop): s_pbc = hop.args_s[0] # possibly more precise than self.s_pbc args_s = hop.args_s[1:] shape, index, callfamily = self._get_shape_index_callfamily( opname, s_pbc, args_s) row_of_graphs = callfamily.calltables[shape][index] anygraph = row_of_graphs.itervalues().next() # pick any witness hop2 = self.add_instance_arg_to_hop(hop, opname == "call_args") vlist = callparse.callparse(self.rtyper, anygraph, hop2, opname, r_self=self.r_im_self) rresult = callparse.getrresult(self.rtyper, anygraph) derived_mangled = self._get_method_name(opname, s_pbc, args_s) cname = hop.inputconst(ootype.Void, derived_mangled) hop.exception_is_here() # sanity check: make sure that INSTANCE has the method self.r_im_self.setup() INSTANCE, meth = self.r_im_self.lowleveltype._lookup(derived_mangled) assert meth is not None, 'Missing method %s in class %s'\ % (derived_mangled, self.r_im_self.lowleveltype) v = hop.genop("oosend", [cname] + vlist, resulttype=rresult) if hop.r_result is impossible_repr: return None # see test_always_raising_methods else: return hop.llops.convertvar(v, rresult, hop.r_result)
def call(self, opname, hop): bk = self.rtyper.annotator.bookkeeper args = bk.build_args(opname, hop.args_s[1:]) s_pbc = hop.args_s[0] # possibly more precise than self.s_pbc descs = list(s_pbc.descriptions) shape, index = description.FunctionDesc.variant_for_call_site(bk, self.callfamily, descs, args) row_of_graphs = self.callfamily.calltables[shape][index] anygraph = row_of_graphs.itervalues().next() # pick any witness vlist = [hop.inputarg(self, arg=0)] vlist += callparse.callparse(self.rtyper, anygraph, hop, opname) rresult = callparse.getrresult(self.rtyper, anygraph) hop.exception_is_here() v_dispatcher = self.dispatcher(shape, index, [v.concretetype for v in vlist[1:]], rresult.lowleveltype) v_result = hop.genop('direct_call', [v_dispatcher] + vlist, resulttype=rresult) return hop.llops.convertvar(v_result, rresult, hop.r_result)
def call(self, opname, hop): bk = self.rtyper.annotator.bookkeeper args = bk.build_args(opname, hop.args_s[1:]) s_pbc = hop.args_s[0] # possibly more precise than self.s_pbc descs = s_pbc.descriptions.keys() shape, index = description.FunctionDesc.variant_for_call_site(bk, self.callfamily, descs, args) row_of_graphs = self.callfamily.calltables[shape][index] anygraph = row_of_graphs.itervalues().next() # pick any witness vlist = [hop.inputarg(self, arg=0)] vlist += callparse.callparse(self.rtyper, anygraph, hop, opname) rresult = callparse.getrresult(self.rtyper, anygraph) hop.exception_is_here() v_dispatcher = self.dispatcher(shape, index, [v.concretetype for v in vlist[1:]], rresult.lowleveltype) v_result = hop.genop('direct_call', [v_dispatcher] + vlist, resulttype=rresult) return hop.llops.convertvar(v_result, rresult, hop.r_result)
def call(self, opname, hop): s_pbc = hop.args_s[0] # possibly more precise than self.s_pbc args_s = hop.args_s[1:] shape, index, callfamily = self._get_shape_index_callfamily(opname, s_pbc, args_s) row_of_graphs = callfamily.calltables[shape][index] anygraph = row_of_graphs.itervalues().next() # pick any witness hop2 = self.add_instance_arg_to_hop(hop, opname == "call_args") vlist = callparse.callparse(self.rtyper, anygraph, hop2, opname, r_self=self.r_im_self) rresult = callparse.getrresult(self.rtyper, anygraph) derived_mangled = self._get_method_name(opname, s_pbc, args_s) cname = hop.inputconst(ootype.Void, derived_mangled) hop.exception_is_here() # sanity check: make sure that INSTANCE has the method self.r_im_self.setup() INSTANCE, meth = self.r_im_self.lowleveltype._lookup(derived_mangled) assert meth is not None, "Missing method %s in class %s" % (derived_mangled, self.r_im_self.lowleveltype) v = hop.genop("oosend", [cname] + vlist, resulttype=rresult) if hop.r_result is impossible_repr: return None # see test_always_raising_methods else: return hop.llops.convertvar(v, rresult, hop.r_result)
def call(self, opname, hop): bk = self.rtyper.annotator.bookkeeper args = bk.build_args(opname, hop.args_s[1:]) s_pbc = hop.args_s[0] # possibly more precise than self.s_pbc descs = s_pbc.descriptions.keys() shape, index = description.FunctionDesc.variant_for_call_site( bk, self.callfamily, descs, args) row_of_graphs = self.callfamily.calltables[shape][index] anygraph = row_of_graphs.itervalues().next() # pick any witness vfn = hop.inputarg(self, arg=0) vlist = [self.convert_to_concrete_llfn(vfn, shape, index, hop.llops)] vlist += callparse.callparse(self.rtyper, anygraph, hop, opname) rresult = callparse.getrresult(self.rtyper, anygraph) hop.exception_is_here() if isinstance(vlist[0], Constant): v = hop.genop('direct_call', vlist, resulttype=rresult) else: vlist.append(hop.inputconst(Void, row_of_graphs.values())) v = hop.genop('indirect_call', vlist, resulttype=rresult) if hop.r_result is impossible_repr: return None # see test_always_raising_methods else: return hop.llops.convertvar(v, rresult, hop.r_result)
def call(self, opname, hop): bk = self.rtyper.annotator.bookkeeper args = bk.build_args(opname, hop.args_s[1:]) s_pbc = hop.args_s[0] # possibly more precise than self.s_pbc descs = s_pbc.descriptions.keys() shape, index = description.FunctionDesc.variant_for_call_site(bk, self.callfamily, descs, args) row_of_graphs = self.callfamily.calltables[shape][index] anygraph = row_of_graphs.itervalues().next() # pick any witness vfn = hop.inputarg(self, arg=0) vlist = [self.convert_to_concrete_llfn(vfn, shape, index, hop.llops)] vlist += callparse.callparse(self.rtyper, anygraph, hop, opname) rresult = callparse.getrresult(self.rtyper, anygraph) hop.exception_is_here() if isinstance(vlist[0], Constant): v = hop.genop('direct_call', vlist, resulttype = rresult) else: vlist.append(hop.inputconst(Void, row_of_graphs.values())) v = hop.genop('indirect_call', vlist, resulttype = rresult) if hop.r_result is impossible_repr: return None # see test_always_raising_methods else: return hop.llops.convertvar(v, rresult, hop.r_result)