[pypy-commit] stmgc card-marking: clean cards on abort

Raemi noreply at buildbot.pypy.org
Tue May 20 17:05:25 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: card-marking
Changeset: r1220:e1ac75ed3871
Date: 2014-05-20 15:41 +0200
http://bitbucket.org/pypy/stmgc/changeset/e1ac75ed3871/

Log:	clean cards on abort

diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -359,6 +359,12 @@
     }
 
     tree_clear(pseg->nursery_objects_shadows);
+
+    if (STM_PSEGMENT->old_objects_with_cards) {
+        LIST_FOREACH_R(STM_PSEGMENT->old_objects_with_cards, object_t * /*item*/,
+                       _reset_cards(item));
+    }
+
     return nursery_used;
 }
 
diff --git a/c7/test/test_card_marking.py b/c7/test/test_card_marking.py
--- a/c7/test/test_card_marking.py
+++ b/c7/test/test_card_marking.py
@@ -106,10 +106,6 @@
         assert not stm_was_written(o)
         assert stm_was_written_card(o)
 
-        print modified_old_objects()
-        print objects_pointing_to_nursery()
-        print old_objects_with_cards()
-
         self.push_root(o)
         stm_minor_collect()
         o = self.pop_root()
@@ -117,3 +113,34 @@
         assert not is_in_nursery(stm_get_ref(o, 199))
         assert not is_in_nursery(stm_get_ref(o, 1))
         assert stm_get_ref(o, 100) == e # not traced
+
+    def test_abort_cleanup(self):
+        o = stm_allocate_old_refs(200, True)
+        self.start_transaction()
+        stm_minor_collect()
+
+        p = stm_allocate_refs(64)
+        d = stm_allocate(64)
+        e = stm_allocate(64)
+        stm_set_ref(o, 199, p, True)
+        stm_set_ref(o, 1, d, True)
+        stm_set_ref(p, 1, e)
+
+        self.abort_transaction()
+
+        assert not modified_old_objects()
+        assert not objects_pointing_to_nursery()
+        assert not old_objects_with_cards()
+
+        self.start_transaction()
+        d = stm_allocate(64)
+        e = stm_allocate(64)
+        lib._set_ptr(o, 199, d) # no barrier
+        stm_set_ref(o, 1, e, True) # card barrier
+
+        self.push_root(o)
+        stm_minor_collect()
+        o = self.pop_root()
+
+        assert not is_in_nursery(stm_get_ref(o, 1))
+        assert is_in_nursery(stm_get_ref(o, 199)) # not traced


More information about the pypy-commit mailing list