def specialize_call(self, hop): from pypy.rpython.lltypesystem import rclass, lltype classrepr = rclass.get_type_repr(hop.rtyper) hop.exception_cannot_occur() v_inst = hop.inputarg(hop.args_r[0], arg=0) v_cls = hop.inputarg(classrepr, arg=1) return hop.genop("jit_record_known_class", [v_inst, v_cls], resulttype=lltype.Void)
def specialize_call(self, hop): from pypy.rpython.lltypesystem import rclass, lltype classrepr = rclass.get_type_repr(hop.rtyper) hop.exception_cannot_occur() v_inst = hop.inputarg(hop.args_r[0], arg=0) v_cls = hop.inputarg(classrepr, arg=1) return hop.genop('jit_record_known_class', [v_inst, v_cls], resulttype=lltype.Void)
def rtype_instantiate(hop): s_class = hop.args_s[0] assert isinstance(s_class, annmodel.SomePBC) if len(s_class.descriptions) != 1: # instantiate() on a variable class vtypeptr, = hop.inputargs(rclass.get_type_repr(hop.rtyper)) v_inst = hop.gendirectcall(ll_instantiate, vtypeptr) return hop.genop('cast_pointer', [v_inst], # v_type implicit in r_result resulttype = hop.r_result.lowleveltype) classdef = s_class.descriptions.keys()[0].getuniqueclassdef() return rclass.rtype_new_instance(hop.rtyper, classdef, hop.llops)