Esempio n. 1
0
 def generate_function(self, funcname, func, ARGS, RESULT=llmemory.GCREF):
     """Generates a variant of malloc with the given name and the given
     arguments.  It should return NULL if out of memory.  If it raises
     anything, it must be an optional MemoryError.
     """
     FUNCPTR = lltype.Ptr(lltype.FuncType(ARGS, RESULT))
     descr = get_call_descr(self, ARGS, RESULT)
     setattr(self, funcname, func)
     setattr(self, funcname + '_FUNCPTR', FUNCPTR)
     setattr(self, funcname + '_descr', descr)
     self._generated_functions.append(funcname)
Esempio n. 2
0
File: gc.py Progetto: weijiwei/pypy
 def generate_function(self, funcname, func, ARGS, RESULT=llmemory.GCREF):
     """Generates a variant of malloc with the given name and the given
     arguments.  It should return NULL if out of memory.  If it raises
     anything, it must be an optional MemoryError.
     """
     FUNCPTR = lltype.Ptr(lltype.FuncType(ARGS, RESULT))
     descr = get_call_descr(self, ARGS, RESULT)
     setattr(self, funcname, func)
     setattr(self, funcname + '_FUNCPTR', FUNCPTR)
     setattr(self, funcname + '_descr', descr)
     self._generated_functions.append(funcname)
Esempio n. 3
0
 def generate_function(self, funcname, func, ARGS, RESULT=llmemory.GCREF):
     """Generates a variant of malloc with the given name and the given
     arguments.  It should return NULL if out of memory.  If it raises
     anything, it must be an optional MemoryError.
     """
     FUNCPTR = lltype.Ptr(lltype.FuncType(ARGS, RESULT))
     # Note: the call may invoke the GC, which may run finalizers.
     # Finalizers are constrained in what they can do, but we can't
     # really express that in a useful way here.
     descr = get_call_descr(self, ARGS, RESULT, EffectInfo.MOST_GENERAL)
     setattr(self, funcname, func)
     setattr(self, funcname + '_FUNCPTR', FUNCPTR)
     setattr(self, funcname + '_descr', descr)
     self._generated_functions.append(funcname)
Esempio n. 4
0
File: gc.py Progetto: mozillazg/pypy
 def generate_function(self, funcname, func, ARGS, RESULT=llmemory.GCREF):
     """Generates a variant of malloc with the given name and the given
     arguments.  It should return NULL if out of memory.  If it raises
     anything, it must be an optional MemoryError.
     """
     FUNCPTR = lltype.Ptr(lltype.FuncType(ARGS, RESULT))
     # Note: the call may invoke the GC, which may run finalizers.
     # Finalizers are constrained in what they can do, but we can't
     # really express that in a useful way here.
     descr = get_call_descr(self, ARGS, RESULT, EffectInfo.MOST_GENERAL)
     setattr(self, funcname, func)
     setattr(self, funcname + '_FUNCPTR', FUNCPTR)
     setattr(self, funcname + '_descr', descr)
     self._generated_functions.append(funcname)
Esempio n. 5
0
File: gc.py Progetto: xen0n/pypy
 def __init__(self, gcdescr, translator=None, rtyper=None):
     GcCache.__init__(self, translator is not None, rtyper)
     self.gcdescr = gcdescr
     if translator and translator.config.translation.gcremovetypeptr:
         self.fielddescr_vtable = None
     else:
         self.fielddescr_vtable = get_field_descr(self, rclass.OBJECT,
                                                  'typeptr')
     self._generated_functions = []
     self.memcpy_fn = memcpy_fn
     self.memcpy_descr = get_call_descr(self,
         [lltype.Signed, lltype.Signed, lltype.Signed], lltype.Void,
         EffectInfo([], [], [], [], [], [], EffectInfo.EF_CANNOT_RAISE,
             can_collect=False))
Esempio n. 6
0
File: llmodel.py Progetto: Mu-L/pypy
 def calldescrof(self, FUNC, ARGS, RESULT, extrainfo):
     return get_call_descr(self.gc_ll_descr, ARGS, RESULT, extrainfo)
Esempio n. 7
0
 def calldescrof(self, FUNC, ARGS, RESULT, extrainfo):
     return get_call_descr(self.gc_ll_descr, ARGS, RESULT, extrainfo)