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)
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)
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)
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)
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)