[pypy-commit] pypy stm-thread-2: Add a few asserts.

arigo noreply at buildbot.pypy.org
Thu Sep 6 15:46:33 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r57176:e971584f29c9
Date: 2012-09-06 15:46 +0200
http://bitbucket.org/pypy/pypy/changeset/e971584f29c9/

Log:	Add a few asserts.

diff --git a/pypy/translator/stm/src_stm/et.c b/pypy/translator/stm/src_stm/et.c
--- a/pypy/translator/stm/src_stm/et.c
+++ b/pypy/translator/stm/src_stm/et.c
@@ -167,6 +167,7 @@
           gcptr L;
           G2L_FIND(d->global_to_local, R, entry, goto not_found);
           L = entry->val;
+          assert(L->h_revision == (revision_t)R);
           if (R_Container && !(R_Container->h_tid & GCFLAG_GLOBAL))
             {    /* R_Container is a local object */
               gcptr *ref = (gcptr *)(((char *)R_Container) + offset);
@@ -196,9 +197,12 @@
   // LatestGlobalRevision(O) would either return O or abort
   // the whole transaction, so omitting it is not wrong
   struct tx_descriptor *d = thread_descriptor;
+  gcptr L;
   wlog_t *entry;
   G2L_FIND(d->global_to_local, O, entry, return O);
-  return entry->val;
+  L = entry->val;
+  assert(L->h_revision == (revision_t)O);
+  return L;
 }
 
 #if 0
@@ -229,6 +233,7 @@
   gcptr L;
   G2L_FIND(d->global_to_local, R, entry, goto not_found);
   L = entry->val;
+  assert(L->h_revision == (revision_t)R);
   return L;
 
  not_found:
@@ -506,9 +511,9 @@
     {
       gcptr R = item->addr;
       gcptr L = item->val;
+      assert(L->h_revision == (revision_t)R);
       if (L->h_tid & GCFLAG_NOT_WRITTEN)
         {
-          assert(L->h_revision == (revision_t)R);
           L->h_tid |= GCFLAG_GLOBAL | GCFLAG_POSSIBLY_OUTDATED;
           continue;
         }


More information about the pypy-commit mailing list