[pypy-commit] stmgc default: In-progress

arigo noreply at buildbot.pypy.org
Sat Jul 6 12:08:48 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r356:5b802f21bafe
Date: 2013-07-06 12:08 +0200
http://bitbucket.org/pypy/stmgc/changeset/5b802f21bafe/

Log:	In-progress

diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -422,29 +422,6 @@
   goto restart_all;
 }
 
-#if 0
-void *stm_DirectReadBarrierFromR(void *G1, void *R_Container1, size_t offset)
-{
-  return _direct_read_barrier((gcptr)G1, (gcptr)R_Container1, offset);
-}
-#endif
-
-gcptr stm_RepeatReadBarrier(gcptr O)
-{
-  abort();//XXX
-#if 0
-  // 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);
-  L = entry->val;
-  assert(L->h_revision == stm_local_revision);
-  return L;
-#endif
-}
-
 static gcptr LocalizeProtected(struct tx_descriptor *d, gcptr P)
 {
   gcptr B;
@@ -749,11 +726,6 @@
   smp_spinloop();
 }
 
-#if 0
-size_t _stm_decode_abort_info(struct tx_descriptor *d, long long elapsed_time,
-                              int abort_reason, char *output);
-#endif
-
 void AbortPrivateFromProtected(struct tx_descriptor *d);
 
 void AbortTransaction(int num)
@@ -795,27 +767,24 @@
     elapsed_time = 1;
   }
 
-#if 0
-  size_t size;
   if (elapsed_time >= d->longest_abort_info_time)
     {
       /* decode the 'abortinfo' and produce a human-readable summary in
          the string 'longest_abort_info' */
-      size = _stm_decode_abort_info(d, elapsed_time, num, NULL);
+      size_t size = stm_decode_abort_info(d, elapsed_time, num, NULL);
       free(d->longest_abort_info);
       d->longest_abort_info = malloc(size);
       if (d->longest_abort_info == NULL)
         d->longest_abort_info_time = 0;   /* out of memory! */
       else
         {
-          if (_stm_decode_abort_info(d, elapsed_time,
+          if (stm_decode_abort_info(d, elapsed_time,
                                      num, d->longest_abort_info) != size)
             stm_fatalerror("during stm abort: object mutated unexpectedly\n");
 
           d->longest_abort_info_time = elapsed_time;
         }
     }
-#endif
 
   /* upon abort, set the reads size limit to 94% of how much was read
      so far.  This should ensure that, assuming the retry does the same
diff --git a/c4/et.h b/c4/et.h
--- a/c4/et.h
+++ b/c4/et.h
@@ -181,7 +181,6 @@
 void SpinLoop(int);
 
 gcptr stm_DirectReadBarrier(gcptr);
-gcptr stm_RepeatReadBarrier(gcptr);
 gcptr stm_WriteBarrier(gcptr);
 gcptr _stm_nonrecord_barrier(gcptr);  /* debugging: read barrier, but
                                          not recording anything */
diff --git a/c4/extra.c b/c4/extra.c
--- a/c4/extra.c
+++ b/c4/extra.c
@@ -153,10 +153,12 @@
     gcptrlist_reduce_size(&d->abortinfo, newsize < 0 ? 0 : newsize);
 }
 
-#if 0
 size_t stm_decode_abort_info(struct tx_descriptor *d, long long elapsed_time,
                              int abort_reason, char *output)
 {
+    return 1;
+}
+#if 0
     /* re-encodes the abort info as a single string.
        For convenience (no escaping needed, no limit on integer
        sizes, etc.) we follow the bittorrent format. */
@@ -233,14 +235,14 @@
                 }
                 break;
             default:
-                fprintf(stderr, "Fatal RPython error: corrupted abort log\n");
-                abort();
+                stm_fatalerror("corrupted abort log\n");
             }
         }
     }
     WRITE('e');
     WRITE('\0');   /* final null character */
 #undef WRITE
+#undef WRITE_BUF
     return totalsize;
 }
 #endif
diff --git a/c4/extra.h b/c4/extra.h
--- a/c4/extra.h
+++ b/c4/extra.h
@@ -3,6 +3,7 @@
 
 
 void stm_copy_to_old_id_copy(gcptr obj, gcptr id);
-
+size_t stm_decode_abort_info(struct tx_descriptor *d, long long elapsed_time,
+                             int abort_reason, char *output);
 
 #endif
diff --git a/c4/test/support.py b/c4/test/support.py
--- a/c4/test/support.py
+++ b/c4/test/support.py
@@ -65,7 +65,7 @@
     long stm_atomic(long delta);
     int stm_enter_callback_call(void);
     void stm_leave_callback_call(int);
-    void stm_abort_info_push(void *obj, void *fieldoffsets);
+    void stm_abort_info_push(gcptr obj, long fieldoffsets[]);
     void stm_abort_info_pop(long count);
     char *stm_inspect_abort_info(void);
 
diff --git a/c4/test/test_extra.py b/c4/test/test_extra.py
--- a/c4/test/test_extra.py
+++ b/c4/test/test_extra.py
@@ -13,7 +13,23 @@
 def test_abort_info_stack():
     p = nalloc(HDR)
     q = nalloc(HDR)
-    lib.stm_abort_info_push(p, ffi.cast("void *", 123))
-    lib.stm_abort_info_push(q, ffi.cast("void *", 125))
+    lib.stm_abort_info_push(p, ffi.cast("long *", 123))
+    lib.stm_abort_info_push(q, ffi.cast("long *", 125))
     lib.stm_abort_info_pop(2)
     # no real test here
+
+def test_inspect_abort_info_signed():
+    py.test.skip("in-progress")
+    fo1 = ffi.new("long[]", [-2, 1, HDR, -1, 0])
+    #
+    @perform_transaction
+    def run(retry_counter):
+        if retry_counter == 0:
+            p = nalloc(HDR + WORD)
+            lib.setlong(p, 0, -421289712)
+            lib.stm_abort_info_push(p, fo1)
+            abort_and_retry()
+        else:
+            c = lib.stm_inspect_abort_info()
+            assert c
+            assert ffi.string(c) == "???"


More information about the pypy-commit mailing list