def s_list_of_gcrefs(): global _cache_s_list_of_gcrefs if _cache_s_list_of_gcrefs is None: from rpython.annotator import model as annmodel from rpython.rtyper.llannotation import SomePtr from rpython.annotator.listdef import ListDef s_gcref = SomePtr(llmemory.GCREF) _cache_s_list_of_gcrefs = annmodel.SomeList( ListDef(None, s_gcref, mutated=True, resized=False)) return _cache_s_list_of_gcrefs
def array(element): listdef = ListDef(None, element, mutated=True, resized=False) return model.SomeList(listdef)
# Dumpers and loaders TYPE_NONE = 'N' TYPE_FALSE = 'F' TYPE_TRUE = 'T' TYPE_INT = 'i' TYPE_INT64 = 'I' TYPE_FLOAT = 'f' TYPE_STRING = 's' TYPE_TUPLE = '(' TYPE_LIST = '[' TYPE_DICT = '{' dumpers = [] loaders = [] s_list_of_chars = annmodel.SomeList( ListDef(None, annmodel.SomeChar(), mutated=True, resized=True)) def add_dumper(s_obj, dumper): dumpers.append((s_obj, dumper)) dumper.s_obj = s_obj dumper._annenforceargs_ = [s_list_of_chars, s_obj] def add_loader(s_obj, loader): # 's_obj' should be the **least general annotation** that we're # interested in, somehow loaders.append((s_obj, loader)) def get_dumper_annotation(dumper):