Author: Remi Meier <remi.me...@inf.ethz.ch>
Branch: card-marking
Changeset: r1214:e6dc7f070560
Date: 2014-05-19 16:59 +0200
http://bitbucket.org/pypy/stmgc/changeset/e6dc7f070560/

Log:    introduce old_objects_with_cards; 2 tests pass

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -58,7 +58,7 @@
                here for every card to mark */
             if (!(obj->stm_flags & GCFLAG_CARDS_SET)) {
                 /* not yet in the list */
-                LIST_APPEND(STM_PSEGMENT->objects_pointing_to_nursery, obj);
+                LIST_APPEND(STM_PSEGMENT->old_objects_with_cards, obj);
                 obj->stm_flags |= GCFLAG_CARDS_SET;
             }
 
@@ -68,8 +68,12 @@
             assert(!write_locks[lock_idx]);
             write_locks[lock_idx] = STM_PSEGMENT->write_lock_num;
         }
+
+        /* We don't need to do anything in the STM part of the WB slowpath: */
         return true;
     }
+
+    /* continue in STM part with no-overflow object */
     return false;
 }
 
@@ -512,6 +516,7 @@
 
     /* reset these lists to NULL for the next transaction */
     LIST_FREE(STM_PSEGMENT->objects_pointing_to_nursery);
+    LIST_FREE(STM_PSEGMENT->old_objects_with_cards);
     LIST_FREE(STM_PSEGMENT->large_overflow_objects);
 
     timing_end_transaction(attribute_to);
@@ -690,6 +695,7 @@
 
     /* reset these lists to NULL too on abort */
     LIST_FREE(pseg->objects_pointing_to_nursery);
+    LIST_FREE(pseg->old_objects_with_cards);
     LIST_FREE(pseg->large_overflow_objects);
     list_clear(pseg->young_weakrefs);
 }
diff --git a/c7/stm/core.h b/c7/stm/core.h
--- a/c7/stm/core.h
+++ b/c7/stm/core.h
@@ -103,6 +103,10 @@
        understood as meaning implicitly "this is the same as
        'modified_old_objects'". */
     struct list_s *objects_pointing_to_nursery;
+    /* Like objects_pointing_to_nursery it holds the old objects that
+       we did a stm_write_card() on. Objects can be in both lists.
+       It is NULL iff objects_pointing_to_nursery is NULL. */
+    struct list_s *old_objects_with_cards;
 
     /* List of all large, overflowed objects.  Only non-NULL after the
        current transaction spanned a minor collection. */
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -332,6 +332,7 @@
     uintptr_t num_old;
     if (STM_PSEGMENT->objects_pointing_to_nursery == NULL) {
         STM_PSEGMENT->objects_pointing_to_nursery = list_create();
+        STM_PSEGMENT->old_objects_with_cards = list_create();
 
         /* See the doc of 'objects_pointing_to_nursery': if it is NULL,
            then it is implicitly understood to be equal to
diff --git a/c7/stm/setup.c b/c7/stm/setup.c
--- a/c7/stm/setup.c
+++ b/c7/stm/setup.c
@@ -119,6 +119,7 @@
         pr->pub.segment_num = i;
         pr->pub.segment_base = segment_base;
         pr->objects_pointing_to_nursery = NULL;
+        pr->old_objects_with_cards = NULL;
         pr->large_overflow_objects = NULL;
         pr->modified_old_objects = list_create();
         pr->modified_old_objects_markers = list_create();
@@ -158,6 +159,7 @@
     for (i = 1; i <= NB_SEGMENTS; i++) {
         struct stm_priv_segment_info_s *pr = get_priv_segment(i);
         assert(pr->objects_pointing_to_nursery == NULL);
+        assert(pr->old_objects_with_cards == NULL);
         assert(pr->large_overflow_objects == NULL);
         list_free(pr->modified_old_objects);
         list_free(pr->modified_old_objects_markers);
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to