[pypy-commit] pypy quad-color-gc: malloc_fixedsize_clear sets tid

ntruessel pypy.commits at gmail.com
Mon Aug 22 11:30:29 EDT 2016


Author: Nicolas Truessel <ntruessel at njsm.de>
Branch: quad-color-gc
Changeset: r86423:f8a7404b3803
Date: 2016-08-22 17:29 +0200
http://bitbucket.org/pypy/pypy/changeset/f8a7404b3803/

Log:	malloc_fixedsize_clear sets tid

diff --git a/rpython/memory/gc/qcgc.py b/rpython/memory/gc/qcgc.py
--- a/rpython/memory/gc/qcgc.py
+++ b/rpython/memory/gc/qcgc.py
@@ -32,8 +32,12 @@
         ll_assert(not needs_finalizer, 'finalizer not supported')
         ll_assert(not is_finalizer_light, 'light finalizer not supported')
         ll_assert(not contains_weakptr, 'weakref not supported')
-        # FIXME: set typeid and hash here
-        return llop.qcgc_allocate(llmemory.GCREF, size, typeid)
+        raw_mem = llop.qcgc_allocate(llmemory.Address, size, typeid)
+        hdr = llmemory.cast_adr_to_ptr(raw_mem, lltype.Ptr(self.HDR))
+        hdr.tid = rffi.cast(lltype.Signed, typeid)
+        # FIXME: set hash
+        # XXX: Hope the tid/hash setting here is not removed/optimized out
+        return llmemory.cast_adr_to_ptr(raw_mem, llmemory.GCREF)
 
     def malloc_varsize_clear(self, typeid16, length, size, itemsize,
                              offset_to_length):


More information about the pypy-commit mailing list