コード例 #1
0
ファイル: gcwrapper.py プロジェクト: griels/pypy-sc
 def malloc_resizable_buffer(self, TYPE, n):
     typeid = self.get_type_id(TYPE)
     addr = self.gc.malloc(typeid, n)
     result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
     if not self.gc.malloc_zero_filled:
         gctypelayout.zero_gc_pointers(result)
     return result
コード例 #2
0
 def malloc_resizable_buffer(self, TYPE, n):
     typeid = self.get_type_id(TYPE)
     addr = self.gc.malloc(typeid, n)
     result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
     if not self.gc.malloc_zero_filled:
         gctypelayout.zero_gc_pointers(result)
     return result
コード例 #3
0
 def malloc_nonmovable(self, TYPE, n=None, zero=False):
     typeid = self.get_type_id(TYPE)
     if not self.gc.can_malloc_nonmovable():
         return lltype.nullptr(TYPE)
     addr = self.gc.malloc_nonmovable(typeid, n, zero=zero)
     result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
     if not self.gc.malloc_zero_filled:
         gctypelayout.zero_gc_pointers(result)
     return result
コード例 #4
0
ファイル: gcwrapper.py プロジェクト: griels/pypy-sc
 def malloc_nonmovable(self, TYPE, n=None, zero=False):
     typeid = self.get_type_id(TYPE)
     if not self.gc.can_malloc_nonmovable():
         return lltype.nullptr(TYPE)
     addr = self.gc.malloc_nonmovable(typeid, n, zero=zero)
     result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
     if not self.gc.malloc_zero_filled:
         gctypelayout.zero_gc_pointers(result)
     return result
コード例 #5
0
 def malloc(self, TYPE, n=None, flavor="gc", zero=False):
     if flavor == "gc":
         typeid = self.get_type_id(TYPE)
         addr = self.gc.malloc(typeid, n, zero=zero)
         result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
         if not self.gc.malloc_zero_filled:
             gctypelayout.zero_gc_pointers(result)
         return result
     else:
         return lltype.malloc(TYPE, n, flavor=flavor, zero=zero)
コード例 #6
0
 def malloc(self, TYPE, n=None, flavor='gc', zero=False):
     if flavor == 'gc':
         typeid = self.get_type_id(TYPE)
         addr = self.gc.malloc(typeid, n, zero=zero)
         result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
         if not self.gc.malloc_zero_filled:
             gctypelayout.zero_gc_pointers(result)
         return result
     else:
         return lltype.malloc(TYPE, n, flavor=flavor, zero=zero)
コード例 #7
0
ファイル: gcwrapper.py プロジェクト: antoine1fr/pygirl
 def coalloc(self, TYPE, coallocator, size=None, zero=False):
     if hasattr(self.gc, "coalloc_fixedsize_clear"):
         typeid = self.get_type_id(TYPE)
         addr = self.gc.malloc(typeid, size, zero=zero,
                               coallocator=coallocator)
         result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
         if not self.gc.malloc_zero_filled:
             gctypelayout.zero_gc_pointers(result)
         return result
     return self.malloc(TYPE, size, 'gc', zero)
コード例 #8
0
 def coalloc(self, TYPE, coallocator, size=None, zero=False):
     if hasattr(self.gc, "coalloc_fixedsize_clear"):
         typeid = self.get_type_id(TYPE)
         addr = self.gc.malloc(typeid,
                               size,
                               zero=zero,
                               coallocator=coallocator)
         result = llmemory.cast_adr_to_ptr(addr, lltype.Ptr(TYPE))
         if not self.gc.malloc_zero_filled:
             gctypelayout.zero_gc_pointers(result)
         return result
     return self.malloc(TYPE, size, 'gc', zero)