Пример #1
0
 def specialize_call(self, hop):
     from rpython.rtyper.rclass import InstanceRepr
     translator = hop.rtyper.annotator.translator
     fq = hop.args_s[0].const
     graph = translator._graphof(fq.finalizer_trigger.im_func)
     InstanceRepr.check_graph_of_del_does_not_call_too_much(
         hop.rtyper, graph)
     hop.exception_cannot_occur()
     return hop.inputconst(lltype.Signed, hop.s_result.const)
Пример #2
0
 def specialize_call(self, hop):
     from rpython.rtyper.rclass import InstanceRepr
     translator = hop.rtyper.annotator.translator
     fq = hop.args_s[0].const
     graph = translator._graphof(fq.finalizer_trigger.im_func)
     InstanceRepr.check_graph_of_del_does_not_call_too_much(hop.rtyper,
                                                            graph)
     hop.exception_cannot_occur()
     return hop.inputconst(lltype.Signed, hop.s_result.const)
Пример #3
0
 def _setup_repr(self):
     InstanceRepr._setup_repr(self)
     flds = self.allinstancefields.keys()
     flds.remove('__class__')
     if self.is_parent:
         if flds:
             raise TyperError("%r is a base class of an UnboxedValue,"
                              "so it cannot have fields: %r" %
                              (self.classdef, flds))
     else:
         if len(flds) != 1:
             raise TyperError("%r must have exactly one field: %r" %
                              (self.classdef, flds))
         self.specialfieldname = flds[0]
Пример #4
0
 def _setup_repr(self):
     InstanceRepr._setup_repr(self)
     flds = self.allinstancefields.keys()
     flds.remove('__class__')
     if self.is_parent:
         if flds:
             raise TyperError("%r is a base class of an UnboxedValue,"
                              "so it cannot have fields: %r" % (
                 self.classdef, flds))
     else:
         if len(flds) != 1:
             raise TyperError("%r must have exactly one field: %r" % (
                 self.classdef, flds))
         self.specialfieldname = flds[0]
Пример #5
0
 def ll_str(self, i):
     if lltype.cast_ptr_to_int(i) & 1:
         from rpython.rtyper.lltypesystem import rstr
         from rpython.rtyper.rint import signed_repr
         llstr1 = signed_repr.ll_str(ll_unboxed_to_int(i))
         return rstr.ll_strconcat(
             rstr.unboxed_instance_str_prefix,
             rstr.ll_strconcat(llstr1, rstr.unboxed_instance_str_suffix))
     else:
         return InstanceRepr.ll_str(self, i)
Пример #6
0
 def ll_str(self, i):
     if lltype.cast_ptr_to_int(i) & 1:
         from rpython.rtyper.lltypesystem import rstr
         from rpython.rtyper.rint import signed_repr
         llstr1 = signed_repr.ll_str(ll_unboxed_to_int(i))
         return rstr.ll_strconcat(rstr.unboxed_instance_str_prefix,
                   rstr.ll_strconcat(llstr1,
                                     rstr.unboxed_instance_str_suffix))
     else:
         return InstanceRepr.ll_str(self, i)
Пример #7
0
 def __init__(self, rtyper, classdef, unboxedclassdef):
     InstanceRepr.__init__(self, rtyper, classdef)
     self.unboxedclassdef = unboxedclassdef
     self.is_parent = unboxedclassdef is not classdef
Пример #8
0
 def __init__(self, rtyper, classdef, unboxedclassdef):
     InstanceRepr.__init__(self, rtyper, classdef)
     self.unboxedclassdef = unboxedclassdef
     self.is_parent = unboxedclassdef is not classdef