Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r497:f614fd3a4080
Date: 2013-08-22 22:58 +0200
http://bitbucket.org/pypy/stmgc/changeset/f614fd3a4080/

Log:    Kill v_atomic. After any abort, reset the "atomic" flag to 0,
        because we're anyway then resuming from a transaction start. This
        happens to fix a crash on pypy-stm, but I didn't manage to write a
        test here...

diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -957,6 +957,7 @@
   SpinLoop(SPLP_ABORT);
   // jump back to the setjmp_buf (this call does not return)
   d->active = 0;
+  d->atomic = 0;
   stm_stop_sharedlock();
   longjmp(*d->setjmp_buf, 1);
 }
@@ -1361,6 +1362,7 @@
   revision_t cur_time;
   struct tx_descriptor *d = thread_descriptor;
   assert(d->active >= 1);
+  assert(d->atomic == 0);
   dprintf(("CommitTransaction(%p)\n", d));
   spinlock_acquire(d->public_descriptor->collection_lock, 'C');  /*committing*/
   if (d->public_descriptor->stolen_objects.size != 0)
diff --git a/c4/stmsync.c b/c4/stmsync.c
--- a/c4/stmsync.c
+++ b/c4/stmsync.c
@@ -135,12 +135,11 @@
     jmp_buf _jmpbuf;
     long volatile v_counter = 0;
     gcptr *volatile v_saved_value = stm_shadowstack;
-    long volatile v_atomic;
 
     stm_push_root(arg);
     stm_push_root(END_MARKER_OFF);
 
-    if (!(v_atomic = thread_descriptor->atomic))
+    if (!thread_descriptor->atomic)
         CommitTransaction();
 
 #ifdef _GC_ON_CPYTHON
@@ -159,11 +158,9 @@
     struct tx_descriptor *d = thread_descriptor;
     long counter, result;
     counter = v_counter;
-    d->atomic = v_atomic;
     stm_shadowstack = v_saved_value + 2;   /*skip the two values pushed above*/
 
     do {
-        v_atomic = d->atomic;
         v_counter = counter + 1;
         /* If counter==0, initialize 'reads_size_limit_nonatomic' from the
            configured length limit.  If counter>0, we did an abort, which
@@ -185,6 +182,7 @@
             /* atomic transaction: a common case is that callback() returned
                even though we are atomic because we need a major GC.  For
                that case, release and reaquire the rw lock here. */
+            assert(d->active >= 1);
             stm_possible_safe_point();
         }
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to