[pypy-commit] pypy default: We still need to be a bit more subtle in the non-translated version of
arigo
noreply at buildbot.pypy.org
Thu Aug 13 15:33:04 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r78960:f90be60bb5e3
Date: 2015-08-13 14:32 +0100
http://bitbucket.org/pypy/pypy/changeset/f90be60bb5e3/
Log: We still need to be a bit more subtle in the non-translated version
of this function
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -725,10 +725,16 @@
result_w = []
#
if not we_are_translated(): # fast path before translation
- for gcref in roots: # 'roots' is all objects in this case
- w_obj = callback(gcref)
- if w_obj is not None:
- result_w.append(w_obj)
+ seen = set()
+ while roots:
+ gcref = roots.pop()
+ key = (type(gcref), gcref)
+ if key not in seen:
+ seen.add(key)
+ w_obj = callback(gcref)
+ if w_obj is not None:
+ result_w.append(w_obj)
+ roots.extend(get_rpy_referents(gcref))
return result_w
#
pending = roots[:]
More information about the pypy-commit
mailing list