[pypy-commit] pypy quad-color-gc: Remove assertions and just ignore finalizers

ntruessel pypy.commits at gmail.com
Sun Aug 28 12:26:39 EDT 2016


Author: Nicolas Truessel <ntruessel at njsm.de>
Branch: quad-color-gc
Changeset: r86643:a6e4ededebb0
Date: 2016-08-28 18:25 +0200
http://bitbucket.org/pypy/pypy/changeset/a6e4ededebb0/

Log:	Remove assertions and just ignore finalizers

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
@@ -40,10 +40,9 @@
                                needs_finalizer=False,
                                is_finalizer_light=False,
                                contains_weakptr=False):
-        # XXX: What is the llmemory.GCREF for? (Assumption: return value)
-        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')
+        #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')
         obj = llop.qcgc_allocate(llmemory.Address, size)
         self.init_gc_object(obj, typeid)
         return llmemory.cast_adr_to_ptr(obj, llmemory.GCREF)
diff --git a/rpython/memory/gctransform/qcgcframework.py b/rpython/memory/gctransform/qcgcframework.py
--- a/rpython/memory/gctransform/qcgcframework.py
+++ b/rpython/memory/gctransform/qcgcframework.py
@@ -33,6 +33,20 @@
                   [SomeAddress(), SomePtr(VISIT_FPTR)],
                   s_None))
 
+    def gc_header_for(self, obj, needs_hash=False):
+        hdr = self.gcdata.gc.gcheaderbuilder.header_of_object(obj)
+        withhash, flag = self.gcdata.gc.withhash_flag_is_in_field
+        x = getattr(hdr, withhash)
+        TYPE = lltype.typeOf(x)
+        x = lltype.cast_primitive(lltype.Signed, x)
+        if needs_hash:
+            x |= flag       # set the flag in the header
+        else:
+            x &= ~flag      # clear the flag in the header
+        x = lltype.cast_primitive(TYPE, x)
+        setattr(hdr, withhash, x)
+        return hdr
+
     def push_roots(self, hop, keep_current_args=False):
         livevars = self.get_livevars_for_roots(hop, keep_current_args)
         self.num_pushs += len(livevars)


More information about the pypy-commit mailing list