[pypy-commit] pypy stm-thread-2: Test and fix

arigo noreply at buildbot.pypy.org
Fri Feb 22 13:07:32 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r61598:62ed6ba35d69
Date: 2013-02-22 12:43 +0100
http://bitbucket.org/pypy/pypy/changeset/62ed6ba35d69/

Log:	Test and fix

diff --git a/rpython/translator/stm/src_stm/rpyintf.c b/rpython/translator/stm/src_stm/rpyintf.c
--- a/rpython/translator/stm/src_stm/rpyintf.c
+++ b/rpython/translator/stm/src_stm/rpyintf.c
@@ -198,15 +198,20 @@
 
 void stm_abort_info_push(void *obj, void *fieldoffsets)
 {
-  struct tx_descriptor *d = thread_descriptor;
-  gcptrlist_insert2(&d->abortinfo, (gcptr)obj, (gcptr)fieldoffsets);
+    struct tx_descriptor *d = thread_descriptor;
+    gcptr P = (gcptr)obj;
+    if ((P->h_tid & GCFLAG_GLOBAL) &&
+        (P->h_tid & GCFLAG_POSSIBLY_OUTDATED)) {
+        P = LatestGlobalRevision(d, P, NULL, 0);
+    }
+    gcptrlist_insert2(&d->abortinfo, P, (gcptr)fieldoffsets);
 }
 
 void stm_abort_info_pop(long count)
 {
-  struct tx_descriptor *d = thread_descriptor;
-  long newsize = d->abortinfo.size - 2 * count;
-  gcptrlist_reduce_size(&d->abortinfo, newsize < 0 ? 0 : newsize);
+    struct tx_descriptor *d = thread_descriptor;
+    long newsize = d->abortinfo.size - 2 * count;
+    gcptrlist_reduce_size(&d->abortinfo, newsize < 0 ? 0 : newsize);
 }
 
 size_t _stm_decode_abort_info(struct tx_descriptor *d, char *output)
@@ -224,7 +229,7 @@
                            }
     WRITE('l');
     for (i=0; i<d->abortinfo.size; i+=2) {
-        char *object       = (char*)d->abortinfo.items[i+0];
+        char *object = (char *)stm_RepeatReadBarrier(d->abortinfo.items[i+0]);
         long *fieldoffsets = (long*)d->abortinfo.items[i+1];
         long kind, offset;
         char buffer[32];
@@ -258,10 +263,15 @@
                 break;
             case 3:    /* pointer to STR */
                 rps = *(RPyString **)(object + offset);
-                rps_size = RPyString_Size(rps);
-                res_size = sprintf(buffer, "%zu:", rps_size);
-                WRITE_BUF(buffer, res_size);
-                WRITE_BUF(_RPyString_AsString(rps), rps_size);
+                if (rps) {
+                    rps_size = RPyString_Size(rps);
+                    res_size = sprintf(buffer, "%zu:", rps_size);
+                    WRITE_BUF(buffer, res_size);
+                    WRITE_BUF(_RPyString_AsString(rps), rps_size);
+                }
+                else {
+                    WRITE_BUF("0:", 2);
+                }
                 break;
             default:
                 fprintf(stderr, "Fatal RPython error: corrupted abort log\n");
diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -138,9 +138,13 @@
             pass
         globf = Foobar()
 
+        def setxy(globf, retry_counter):
+            if retry_counter > 1:
+                globf.xy = 100 + retry_counter
+
         def check(_, retry_counter):
-            globf.xy = 100 + retry_counter
             rstm.abort_info_push(globf, ('xy', '[', 'yx', ']'))
+            setxy(globf, retry_counter)
             if retry_counter < 3:
                 rstm.abort_and_retry()
             #


More information about the pypy-commit mailing list