Author: Armin Rigo <[email protected]>
Branch:
Changeset: r86024:9adb8eec4ac2
Date: 2016-08-05 08:32 +0200
http://bitbucket.org/pypy/pypy/changeset/9adb8eec4ac2/
Log: Found out why we couldn't call
_add_to_more_objects_to_trace_*if_black* here. Potential obscure fix
for other cases too.
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
@@ -1632,7 +1632,7 @@
# This is because these are precisely the old objects that
# have been modified and need rescanning.
self.old_objects_pointing_to_young.foreach(
- self._add_to_more_objects_to_trace, None)
+ self._add_to_more_objects_to_trace_if_black, 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
@@ -2269,6 +2269,11 @@
if (not self.objects_to_trace.non_empty() and
not self.more_objects_to_trace.non_empty()):
#
+ # First, 'prebuilt_root_objects' might have grown since
+ # we scanned it in collect_roots() (rare case). Rescan.
+ self.collect_nonstack_roots()
+ self.visit_all_objects()
+ #
if self.rrc_enabled:
self.rrc_major_collection_trace()
#
@@ -2449,21 +2454,30 @@
return nobjects
- def collect_roots(self):
- # Collect all roots. Starts from all the objects
- # from 'prebuilt_root_objects'.
+ def collect_nonstack_roots(self):
+ # Non-stack roots: first, the objects from 'prebuilt_root_objects'
self.prebuilt_root_objects.foreach(self._collect_obj, None)
#
- # Add the roots from the other sources.
+ # Add the roots from static prebuilt non-gc structures
self.root_walker.walk_roots(
- IncrementalMiniMarkGC._collect_ref_stk, # stack roots
- IncrementalMiniMarkGC._collect_ref_stk, # static in prebuilt
non-gc structures
+ None,
+ IncrementalMiniMarkGC._collect_ref_stk,
None) # we don't need the static in all prebuilt gc objects
#
# If we are in an inner collection caused by a call to a finalizer,
# the 'run_finalizers' objects also need to be kept alive.
self.enum_pending_finalizers(self._collect_obj, None)
+ def collect_roots(self):
+ # Collect all roots. Starts from the non-stack roots.
+ self.collect_nonstack_roots()
+ #
+ # Add the stack roots.
+ self.root_walker.walk_roots(
+ IncrementalMiniMarkGC._collect_ref_stk, # stack roots
+ None,
+ None)
+
def enumerate_all_roots(self, callback, arg):
self.prebuilt_root_objects.foreach(callback, arg)
MovingGCBase.enumerate_all_roots(self, callback, arg)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit