Example #1
0
 def malloc_big_fixedsize(size, tid):
     if self.DEBUG:
         self._random_usage_of_xmm_registers()
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     return llop1.do_malloc_fixedsize_clear(llmemory.GCREF, type_id,
                                            size, False, False, False)
Example #2
0
 def malloc_array(itemsize, tid, num_elem):
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     return llop1.do_malloc_varsize_clear(
         llmemory.GCREF,
         type_id, num_elem, self.array_basesize, itemsize,
         self.array_length_ofs)
Example #3
0
    def _bh_malloc(self, sizedescr):
        from pypy.rpython.memory.gctypelayout import check_typeid

        llop1 = self.llop1
        type_id = llop.extract_ushort(llgroup.HALFWORD, sizedescr.tid)
        check_typeid(type_id)
        return llop1.do_malloc_fixedsize_clear(llmemory.GCREF, type_id, sizedescr.size, False, False, False)
Example #4
0
 def malloc_array_nonstandard(basesize, itemsize, lengthofs, tid, num_elem):
     """For the rare case of non-standard arrays, i.e. arrays where
     self.standard_array_{basesize,length_ofs} is wrong.  It can
     occur e.g. with arrays of floats on Win32."""
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     return llop1.do_malloc_varsize_clear(llmemory.GCREF, type_id, num_elem, basesize, itemsize, lengthofs)
Example #5
0
 def _bh_malloc(self, sizedescr):
     from pypy.rpython.memory.gctypelayout import check_typeid
     llop1 = self.llop1
     type_id = llop.extract_ushort(llgroup.HALFWORD, sizedescr.tid)
     check_typeid(type_id)
     return llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
                                            type_id, sizedescr.size,
                                            False, False, False)
Example #6
0
 def malloc_big_fixedsize(size, tid):
     if self.DEBUG:
         self._random_usage_of_xmm_registers()
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     return llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
                                            type_id, size,
                                            False, False, False)
Example #7
0
 def malloc_array(itemsize, tid, num_elem):
     """Allocate an array with a variable-size num_elem.
     Only works for standard arrays."""
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     return llop1.do_malloc_varsize_clear(
         llmemory.GCREF,
         type_id, num_elem, self.standard_array_basesize, itemsize,
         self.standard_array_length_ofs)
Example #8
0
 def _bh_malloc_array(self, arraydescr, num_elem):
     from pypy.rpython.memory.gctypelayout import check_typeid
     llop1 = self.llop1
     type_id = llop.extract_ushort(llgroup.HALFWORD, arraydescr.tid)
     check_typeid(type_id)
     return llop1.do_malloc_varsize_clear(llmemory.GCREF, type_id, num_elem,
                                          arraydescr.basesize,
                                          arraydescr.itemsize,
                                          arraydescr.lendescr.offset)
Example #9
0
 def malloc_array(itemsize, tid, num_elem):
     """Allocate an array with a variable-size num_elem.
     Only works for standard arrays."""
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     return llop1.do_malloc_varsize_clear(
         llmemory.GCREF,
         type_id, num_elem, self.standard_array_basesize, itemsize,
         self.standard_array_length_ofs)
Example #10
0
    def _bh_malloc_array(self, arraydescr, num_elem):
        from pypy.rpython.memory.gctypelayout import check_typeid

        llop1 = self.llop1
        type_id = llop.extract_ushort(llgroup.HALFWORD, arraydescr.tid)
        check_typeid(type_id)
        return llop1.do_malloc_varsize_clear(
            llmemory.GCREF, type_id, num_elem, arraydescr.basesize, arraydescr.itemsize, arraydescr.lendescr.offset
        )
Example #11
0
 def malloc_array_nonstandard(basesize, itemsize, lengthofs, tid,
                              num_elem):
     """For the rare case of non-standard arrays, i.e. arrays where
     self.standard_array_{basesize,length_ofs} is wrong.  It can
     occur e.g. with arrays of floats on Win32."""
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     return llop1.do_malloc_varsize_clear(
         llmemory.GCREF,
         type_id, num_elem, basesize, itemsize, lengthofs)
Example #12
0
File: gc.py Project: ieure/pypy
 def malloc_array(itemsize, tid, num_elem):
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     try:
         return llop1.do_malloc_varsize_clear(
             llmemory.GCREF,
             type_id, num_elem, self.array_basesize, itemsize,
             self.array_length_ofs, True)
     except MemoryError:
         fatalerror("out of memory (from JITted code)")
         return lltype.nullptr(llmemory.GCREF.TO)
Example #13
0
 def malloc_basic(size, tid):
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     check_typeid(type_id)
     res = llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
                                           type_id, size,
                                           False, False, False)
     # In case the operation above failed, we are returning NULL
     # from this function to assembler.  There is also an RPython
     # exception set, typically MemoryError; but it's easier and
     # faster to check for the NULL return value, as done by
     # translator/exceptiontransform.py.
     #llop.debug_print(lltype.Void, "\tmalloc_basic", size, type_id,
     #                 "-->", res)
     return res
Example #14
0
File: gc.py Project: ieure/pypy
 def malloc_basic(size, tid):
     type_id = llop.extract_ushort(llgroup.HALFWORD, tid)
     has_finalizer = bool(tid & (1<<llgroup.HALFSHIFT))
     check_typeid(type_id)
     try:
         res = llop1.do_malloc_fixedsize_clear(llmemory.GCREF,
                                               type_id, size, True,
                                               has_finalizer, False)
     except MemoryError:
         fatalerror("out of memory (from JITted code)")
         res = lltype.nullptr(llmemory.GCREF.TO)
     #llop.debug_print(lltype.Void, "\tmalloc_basic", size, type_id,
     #                 "-->", res)
     return res