[pypy-commit] stmgc card-marking: reset cards on overflow objs only needed when aborting (otherwise they are already cleared by normal minor collections)

Raemi noreply at buildbot.pypy.org
Tue Jul 1 11:09:55 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: card-marking
Changeset: r1269:664aca4f69ca
Date: 2014-07-01 11:10 +0200
http://bitbucket.org/pypy/stmgc/changeset/664aca4f69ca/

Log:	reset cards on overflow objs only needed when aborting (otherwise
	they are already cleared by normal minor collections)

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -946,6 +946,24 @@
     /* throw away the content of the nursery */
     long bytes_in_nursery = throw_away_nursery(pseg);
 
+    /* modified_old_objects' cards get cleared in
+       reset_modified_from_other_segments. Objs in old_objs_with_cards but not
+       in modified_old_objs are overflow objects and handled here: */
+    if (pseg->large_overflow_objects != NULL) {
+        /* some overflow objects may have cards when aborting, clear them too */
+        LIST_FOREACH_R(pseg->large_overflow_objects, object_t * /*item*/,
+            {
+                struct object_s *realobj = (struct object_s *)
+                    REAL_ADDRESS(pseg->pub.segment_base, item);
+
+                if (realobj->stm_flags & GCFLAG_CARDS_SET) {
+                    /* CARDS_SET is enough since other HAS_CARDS objs
+                       are already cleared */
+                    _reset_object_cards(pseg, item, CARD_CLEAR, false);
+                }
+            });
+    }
+
     /* reset all the modified objects (incl. re-adding GCFLAG_WRITE_BARRIER) */
     reset_modified_from_other_segments(segment_num);
     _verify_cards_cleared_in_all_lists(pseg);
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -325,7 +325,7 @@
 
 
 
-static inline void _collect_now(object_t *obj, bool was_definitely_young)
+static inline void _collect_now(object_t *obj)
 {
     assert(!_is_young(obj));
     assert(!(obj->stm_flags & GCFLAG_CARDS_SET));
@@ -376,8 +376,7 @@
         uintptr_t obj_sync_now = list_pop_item(lst);
         object_t *obj = (object_t *)(obj_sync_now & ~FLAG_SYNC_LARGE);
 
-        bool was_definitely_young = (obj_sync_now & FLAG_SYNC_LARGE);
-        _collect_now(obj, was_definitely_young);
+        _collect_now(obj);
         assert(!(obj->stm_flags & GCFLAG_CARDS_SET));
 
         if (obj_sync_now & FLAG_SYNC_LARGE) {
@@ -407,7 +406,7 @@
     dprintf(("collect_modified_old_objects\n"));
     LIST_FOREACH_R(
         STM_PSEGMENT->modified_old_objects, object_t * /*item*/,
-        _collect_now(item, false));
+        _collect_now(item));
 }
 
 static void collect_roots_from_markers(uintptr_t num_old)
@@ -475,25 +474,6 @@
 
     tree_clear(pseg->nursery_objects_shadows);
 
-
-    /* modified_old_objects' cards get cleared in push_modified_to_other_segments
-       or reset_modified_from_other_segments. Objs in old_objs_with_cards but not
-       in modified_old_objs are overflow objects and handled here: */
-    if (pseg->large_overflow_objects != NULL) {
-        /* some overflow objects may have cards when aborting, clear them too */
-        LIST_FOREACH_R(pseg->large_overflow_objects, object_t * /*item*/,
-            {
-                struct object_s *realobj = (struct object_s *)
-                    REAL_ADDRESS(pseg->pub.segment_base, item);
-
-                if (realobj->stm_flags & GCFLAG_CARDS_SET) {
-                    /* CARDS_SET is enough since other HAS_CARDS objs
-                       are already cleared */
-                    _reset_object_cards(pseg, item, CARD_CLEAR, false);
-                }
-            });
-    }
-
     return nursery_used;
 #pragma pop_macro("STM_SEGMENT")
 #pragma pop_macro("STM_PSEGMENT")


More information about the pypy-commit mailing list