[pypy-commit] pypy cpyext-gc-cycle: Fixed untracked rawrefcounted objects bug and improved debug output
stevie_92
pypy.commits at gmail.com
Fri May 17 03:18:50 EDT 2019
Author: Stefan Beyer <home at sbeyer.at>
Branch: cpyext-gc-cycle
Changeset: r96631:5621f2f5f876
Date: 2019-05-17 09:17 +0200
http://bitbucket.org/pypy/pypy/changeset/5621f2f5f876/
Log: Fixed untracked rawrefcounted objects bug and improved debug output
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -3119,7 +3119,7 @@
RAWREFCOUNT_FINALIZER_LEGACY = 2
RAWREFCOUNT_REFS_SHIFT = 1
RAWREFCOUNT_REFS_MASK_FINALIZED = 1
- RAWREFCOUNT_REFS_UNTRACKED = -2
+ RAWREFCOUNT_REFS_UNTRACKED = -2 << RAWREFCOUNT_REFS_SHIFT
def _pyobj(self, pyobjaddr):
return llmemory.cast_adr_to_ptr(pyobjaddr, self.PYOBJ_HDR_PTR)
@@ -3595,10 +3595,15 @@
obj = llmemory.cast_int_to_adr(intobj)
gchdr = self.rrc_pyobj_as_gc(pyobj)
if gchdr <> lltype.nullptr(self.PYOBJ_GC_HDR):
- if gchdr.c_gc_refs == self.RAWREFCOUNT_REFS_UNTRACKED:
- debug_print("gc obj not tracked", gchdr, ": obj", obj)
+ rc = gchdr.c_gc_refs
+ refcnt = pyobj.c_ob_refcnt
+ if rc == self.RAWREFCOUNT_REFS_UNTRACKED:
+ debug_print("gc obj not tracked", gchdr, ": obj", obj,
+ "real-rc", refcnt, "cyclic-rc", rc)
else:
- refcnt = pyobj.c_ob_refcnt
+ debug_print("gc obj tracked", gchdr, ": obj", obj, "real-rc",
+ refcnt, "cyclic-rc", rc, "gc-next",
+ gchdr.c_gc_next, "gc-prev", gchdr.c_gc_prev)
if refcnt >= REFCNT_FROM_PYPY_LIGHT:
refcnt -= REFCNT_FROM_PYPY_LIGHT
elif refcnt >= REFCNT_FROM_PYPY:
More information about the pypy-commit
mailing list