[pypy-commit] pypy default: Issue #2363: fix. The issue was a "black->white" rare case in the
arigo
pypy.commits at gmail.com
Thu Aug 4 12:06:35 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r86016:93a5d95ec126
Date: 2016-08-04 18:06 +0200
http://bitbucket.org/pypy/pypy/changeset/93a5d95ec126/
Log: Issue #2363: fix. The issue was a "black->white" rare case in the
incremental GC, which is forbidden.
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
@@ -1633,6 +1633,14 @@
# have been modified and need rescanning.
self.old_objects_pointing_to_young.foreach(
self._add_to_more_objects_to_trace, None)
+ # Old black objects pointing to pinned objects that may no
+ # longer be pinned now: careful,
+ # _visit_old_objects_pointing_to_pinned() will move the
+ # previously-pinned object, and that creates a white object.
+ # We prevent the "black->white" situation by forcing the
+ # old black object to become gray again.
+ self.old_objects_pointing_to_pinned.foreach(
+ self._add_to_more_objects_to_trace_if_black, None)
#
# First, find the roots that point to young objects. All nursery
# objects found are copied out of the nursery, and the occasional
@@ -2144,6 +2152,10 @@
self.header(obj).tid &= ~GCFLAG_VISITED
self.more_objects_to_trace.append(obj)
+ def _add_to_more_objects_to_trace_if_black(self, obj, ignored):
+ if self.header(obj).tid & GCFLAG_VISITED:
+ self._add_to_more_objects_to_trace(obj, ignored)
+
def minor_and_major_collection(self):
# First, finish the current major gc, if there is one in progress.
# This is a no-op if the gc_state is already STATE_SCANNING.
More information about the pypy-commit
mailing list