[pypy-commit] stmgc default: Raah, can't seem to get this right: force_minor_collections()

arigo noreply at buildbot.pypy.org
Mon May 27 10:35:40 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r36:c658753ace12
Date: 2013-05-27 10:35 +0200
http://bitbucket.org/pypy/stmgc/changeset/c658753ace12/

Log:	Raah, can't seem to get this right: force_minor_collections()

diff --git a/c3/et.c b/c3/et.c
--- a/c3/et.c
+++ b/c3/et.c
@@ -774,6 +774,8 @@
   revision_t newrev = -(cur_time + 1);
   assert(newrev & 1);
   ACCESS_ONCE(stm_local_revision) = newrev;
+  fprintf(stderr, "%p: stm_local_revision = %ld\n", d, newrev);
+  assert(d->local_revision_ref = &stm_local_revision);
 
   UpdateChainHeads(d, cur_time, localrev);
 
diff --git a/c3/gcpage.c b/c3/gcpage.c
--- a/c3/gcpage.c
+++ b/c3/gcpage.c
@@ -373,6 +373,9 @@
         revision_t v = obj->h_revision;
         if (!(v & 1)) {  // "is a pointer"
             /* i.e. has a more recent revision.  Oups. */
+            fprintf(stderr,
+                    "ABRT_COLLECT_MAJOR: %p was read but modified already\n",
+                    obj);
             AbortTransactionAfterCollect(d, ABRT_COLLECT_MAJOR);
             return;
         }
@@ -537,23 +540,12 @@
 
 /***** Major collections: forcing minor collections *****/
 
-static void check_different_local_revs(void)
-{
-#ifdef _GC_DEBUG
-    struct tx_descriptor *d, *d2;
-    for (d = tx_head; d; d = d->tx_next) {
-        for (d2 = d->tx_next; d2; d2 = d2->tx_next) {
-            assert(*d->local_revision_ref != *d2->local_revision_ref);
-        }
-    }
-#endif
-}
-
 void force_minor_collections(void)
 {
+    struct tx_descriptor *d;
     struct tx_descriptor *saved = thread_descriptor;
-    revision_t saved_local_rev = *saved->local_revision_ref;
-    struct tx_descriptor *d;
+    revision_t saved_local_rev = stm_local_revision;
+    assert(saved_local_rev == *saved->local_revision_ref);
 
     for (d = tx_head; d; d = d->tx_next) {
         /* Force a minor collection to run in the thread 'd'.
@@ -569,11 +561,10 @@
             assert(stmgc_nursery_hiding(d, 0));
             stmgc_minor_collect_no_abort();
             assert(stmgc_nursery_hiding(d, 1));
+            thread_descriptor = saved;
+            stm_local_revision = saved_local_rev;
         }
     }
-    thread_descriptor = saved;
-    stm_local_revision = saved_local_rev;
-    check_different_local_revs();
 }
 
 


More information about the pypy-commit mailing list