예제 #1
0
파일: rlist.py 프로젝트: purepython/pypy
 def rtype_method_append(self, hop):
     if getattr(self.listitem, 'hint_maxlength', False):
         v_lst, v_value = hop.inputargs(self, self.item_repr)
         hop.exception_cannot_occur()
         hop.gendirectcall(ll_append_noresize, v_lst, v_value)
     else:
         AbstractListRepr.rtype_method_append(self, hop)
예제 #2
0
파일: rlist.py 프로젝트: enyst/plexnet
 def rtype_method_append(self, hop):
     if getattr(self.listitem, 'hint_maxlength', False):
         v_lst, v_value = hop.inputargs(self, self.item_repr)
         hop.exception_cannot_occur()
         hop.gendirectcall(ll_append_noresize, v_lst, v_value)
     else:
         AbstractListRepr.rtype_method_append(self, hop)
예제 #3
0
 def rtype_hint(self, hop):
     optimized = getattr(self.listitem, 'hint_maxlength', False)
     hints = hop.args_s[-1].const
     if 'maxlength' in hints:
         if optimized:
             s_iterable = hop.args_s[1]
             r_iterable = hop.args_r[1]
             v_list = hop.inputarg(self, arg=0)
             v_iterable = hop.inputarg(r_iterable, arg=1)
             hop2 = hop.copy()
             while hop2.nb_args > 0:
                 hop2.r_s_popfirstarg()
             hop2.v_s_insertfirstarg(v_iterable, s_iterable)
             v_maxlength = r_iterable.rtype_len(hop2)
             hop.llops.gendirectcall(ll_set_maxlength, v_list, v_maxlength)
             return v_list
     if 'fence' in hints:
         v_list = hop.inputarg(self, arg=0)
         if isinstance(hop.r_result, FixedSizeListRepr):
             if optimized and 'exactlength' in hints:
                 llfn = ll_list2fixed_exact
             else:
                 llfn = ll_list2fixed
             v_list = hop.llops.gendirectcall(llfn, v_list)
         return v_list
     return AbstractListRepr.rtype_hint(self, hop)
예제 #4
0
파일: rlist.py 프로젝트: alkorzt/pypy
 def rtype_method_append(self, hop):
     if self.known_maxlength:
         v_lst, v_value = hop.inputargs(self, self.item_repr)
         hop.exception_cannot_occur()
         hop.gendirectcall(ll_append_maxlength, v_lst, v_value)
     else:
         return AbstractListRepr.rtype_method_append(self, hop)
예제 #5
0
 def rtype_hint(self, hop):
     optimized = getattr(self.listitem, "hint_maxlength", False)
     hints = hop.args_s[-1].const
     if "maxlength" in hints:
         if optimized:
             s_iterable = hop.args_s[1]
             r_iterable = hop.args_r[1]
             v_list = hop.inputarg(self, arg=0)
             v_iterable = hop.inputarg(r_iterable, arg=1)
             hop2 = hop.copy()
             while hop2.nb_args > 0:
                 hop2.r_s_popfirstarg()
             hop2.v_s_insertfirstarg(v_iterable, s_iterable)
             v_maxlength = r_iterable.rtype_len(hop2)
             hop.llops.gendirectcall(ll_set_maxlength, v_list, v_maxlength)
             return v_list
     if "fence" in hints:
         v_list = hop.inputarg(self, arg=0)
         if isinstance(hop.r_result, FixedSizeListRepr):
             if optimized and "exactlength" in hints:
                 llfn = ll_list2fixed_exact
             else:
                 llfn = ll_list2fixed
             v_list = hop.llops.gendirectcall(llfn, v_list)
         return v_list
     return AbstractListRepr.rtype_hint(self, hop)
예제 #6
0
 def rtype_method_append(self, hop):
     if self.known_maxlength:
         v_lst, v_value = hop.inputargs(self, self.item_repr)
         hop.exception_cannot_occur()
         hop.gendirectcall(ll_append_maxlength, v_lst, v_value)
     else:
         return AbstractListRepr.rtype_method_append(self, hop)
예제 #7
0
파일: rlist.py 프로젝트: enyst/plexnet
 def rtype_hint(self, hop):
     optimized = getattr(self.listitem, 'hint_maxlength', False)
     hints = hop.args_s[-1].const
     if 'maxlength' in hints:
         if optimized:
             v_list = hop.inputarg(self, arg=0)
             v_maxlength = self._get_v_maxlength(hop)
             hop.llops.gendirectcall(ll_set_maxlength, v_list, v_maxlength)
             return v_list
     if 'fence' in hints:
         v_list = hop.inputarg(self, arg=0)
         if isinstance(hop.r_result, FixedSizeListRepr):
             if optimized and 'exactlength' in hints:
                 llfn = ll_list2fixed_exact
             else:
                 llfn = ll_list2fixed
             v_list = hop.llops.gendirectcall(llfn, v_list)
         return v_list
     return AbstractListRepr.rtype_hint(self, hop)
예제 #8
0
파일: rlist.py 프로젝트: purepython/pypy
 def rtype_hint(self, hop):
     optimized = getattr(self.listitem, 'hint_maxlength', False)
     hints = hop.args_s[-1].const
     if 'maxlength' in hints:
         if optimized:
             v_list = hop.inputarg(self, arg=0)
             v_maxlength = self._get_v_maxlength(hop)
             hop.llops.gendirectcall(ll_set_maxlength, v_list, v_maxlength)
             return v_list
     if 'fence' in hints:
         v_list = hop.inputarg(self, arg=0)
         if isinstance(hop.r_result, FixedSizeListRepr):
             if optimized and 'exactlength' in hints:
                 llfn = ll_list2fixed_exact
             else:
                 llfn = ll_list2fixed
             v_list = hop.llops.gendirectcall(llfn, v_list)
         return v_list
     return AbstractListRepr.rtype_hint(self, hop)