[pypy-commit] stmgc card-marking: merge heads

arigo noreply at buildbot.pypy.org
Tue Jul 1 10:45:35 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: card-marking
Changeset: r1268:b9101a55e80d
Date: 2014-07-01 10:45 +0200
http://bitbucket.org/pypy/stmgc/changeset/b9101a55e80d/

Log:	merge heads

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -67,6 +67,7 @@
         /* Card marking.  Don't remove GCFLAG_WRITE_BARRIER because we
            need to come back to _stm_write_slowpath_card() for every
            card to mark.  Add GCFLAG_CARDS_SET. */
+        assert(!(obj->stm_flags & GCFLAG_CARDS_SET));
         obj->stm_flags |= GCFLAG_CARDS_SET;
         assert(STM_PSEGMENT->old_objects_with_cards);
         LIST_APPEND(STM_PSEGMENT->old_objects_with_cards, obj);
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -328,6 +328,7 @@
 static inline void _collect_now(object_t *obj, bool was_definitely_young)
 {
     assert(!_is_young(obj));
+    assert(!(obj->stm_flags & GCFLAG_CARDS_SET));
 
     dprintf(("_collect_now: %p\n", obj));
 
@@ -339,22 +340,6 @@
         stmcb_trace((struct object_s *)realobj, &minor_trace_if_young);
 
         obj->stm_flags |= GCFLAG_WRITE_BARRIER;
-        if (obj->stm_flags & GCFLAG_CARDS_SET) {
-            /* all objects that had WB cleared need to be fully synchronised
-               on commit, so we have to mark all their cards */
-            struct stm_priv_segment_info_s *pseg = get_priv_segment(
-                STM_SEGMENT->segment_num);
-
-            /* stm_wb-slowpath should never have triggered for young objs */
-            assert(!was_definitely_young);
-
-            if (!IS_OVERFLOW_OBJ(STM_PSEGMENT, obj)) {
-                _reset_object_cards(pseg, obj, CARD_MARKED_OLD, true); /* mark all */
-            } else {
-                /* simply clear overflow */
-                _reset_object_cards(pseg, obj, CARD_CLEAR, false);
-            }
-        }
     }
     /* else traced in collect_cardrefs_to_nursery if necessary */
 }
@@ -371,12 +356,11 @@
         assert(!_is_young(obj));
 
         if (!(obj->stm_flags & GCFLAG_CARDS_SET)) {
-            /* handled in _collect_now() */
+            /* sometimes we remove the CARDS_SET in the WB slowpath, see core.c */
             continue;
         }
 
-        /* traces cards, clears marked cards or marks them old if
-           necessary */
+        /* traces cards, clears marked cards or marks them old if necessary */
         _trace_card_object(obj);
 
         assert(!(obj->stm_flags & GCFLAG_CARDS_SET));
@@ -551,6 +535,7 @@
     if (!commit && STM_PSEGMENT->large_overflow_objects == NULL)
         STM_PSEGMENT->large_overflow_objects = list_create();
 
+
     /* All the objects we move out of the nursery become "overflow"
        objects.  We use the list 'objects_pointing_to_nursery'
        to hold the ones we didn't trace so far. */
@@ -558,6 +543,11 @@
     if (STM_PSEGMENT->objects_pointing_to_nursery == NULL) {
         STM_PSEGMENT->objects_pointing_to_nursery = list_create();
 
+        /* collect objs with cards, adds to objects_pointing_to_nursery
+           and makes sure there are no objs with cards left in
+           modified_old_objs */
+        collect_cardrefs_to_nursery();
+
         /* See the doc of 'objects_pointing_to_nursery': if it is NULL,
            then it is implicitly understood to be equal to
            'modified_old_objects'.  We could copy modified_old_objects
@@ -567,6 +557,7 @@
         num_old = 0;
     }
     else {
+        collect_cardrefs_to_nursery();
         num_old = STM_PSEGMENT->modified_old_objects_markers_num_old;
     }
 
@@ -574,7 +565,6 @@
 
     collect_roots_in_nursery();
 
-    collect_cardrefs_to_nursery();
     collect_oldrefs_to_nursery();
     assert(list_is_empty(STM_PSEGMENT->old_objects_with_cards));
 


More information about the pypy-commit mailing list