Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r1593:e7a6ff9e9da3
Date: 2015-01-28 14:24 +0100
http://bitbucket.org/pypy/stmgc/changeset/e7a6ff9e9da3/

Log:    Redo 24ba707614c4, with a way that really fails an assert if the
        assumption is wrong.

diff --git a/c7/stm/gcpage.c b/c7/stm/gcpage.c
--- a/c7/stm/gcpage.c
+++ b/c7/stm/gcpage.c
@@ -425,24 +425,33 @@
 {
     /* The modified objects are the ones that may exist in two different
        versions: one in the segment that modified it, and another in all
-       other segments.  (It can also be more than two if we don't have
-       eager write locking.)
+       other segments.  (It could also be more than two if we did't have
+       eager write locking, but for now we do.)
     */
     long i;
     for (i = 1; i <= NB_SEGMENTS; i++) {
+        LIST_FOREACH_R(
+            get_priv_segment(i)->modified_old_objects,
+            object_t * /*item*/,
+            ({
+                /* This function is called first, and there should not be
+                   any duplicate in modified_old_objects. */
+                if (mark_visited_test_and_set(item)) {
+                    assert(!"duplicate in modified_old_objects!");
+                }
+            }));
+    }
+
+    /* Now that we have marked all modified_old_objects, trace them
+       (which will mark more objects).
+    */
+    for (i = 1; i <= NB_SEGMENTS; i++) {
         char *base = get_segment_base(i);
 
         LIST_FOREACH_R(
             get_priv_segment(i)->modified_old_objects,
             object_t * /*item*/,
             ({
-                /* (arigo) I think that here we need to mark_trace() both
-                   the shared version and the private version in all cases.
-                   Even if the visited flag is already set, we don't know
-                   which version was already traced...  Chances are that
-                   it was the stm_object_pages version, but we are not sure.
-                */
-                mark_visited_test_and_set(item);
                 mark_trace(item, stm_object_pages);  /* shared version */
                 mark_trace(item, base);              /* private version */
             }));
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to