[pypy-commit] stmgc default: Check that the test passes if written this way, retrying up to 1000 times

arigo noreply at buildbot.pypy.org
Wed Jun 19 17:47:00 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r198:8b48f8933856
Date: 2013-06-19 17:46 +0200
http://bitbucket.org/pypy/stmgc/changeset/8b48f8933856/

Log:	Check that the test passes if written this way, retrying up to 1000
	times for stm_read_barrier() to return the same pointer.

diff --git a/c4/demo2.c b/c4/demo2.c
--- a/c4/demo2.c
+++ b/c4/demo2.c
@@ -98,8 +98,15 @@
             r_next = (struct node*)stm_read_barrier((gcptr)tmp);
         }
         // results from consecutive read_barriers can differ. needs Ptr_Eq()
-        /* assert(stm_read_barrier((gcptr)r_prev->next) == r_current */
-        /* 	     && stm_read_barrier((gcptr)r_current->next) == r_next); */
+        int i = 0;
+        while (!(stm_read_barrier((gcptr)r_prev->next) ==
+                 stm_read_barrier((gcptr)r_current) &&
+                 stm_read_barrier((gcptr)r_current->next) ==
+                 stm_read_barrier((gcptr)r_next))) {
+            asm volatile ("pause":::"memory");  /* smp_spinloop() */
+            i++;
+            assert(i < 1000);
+        }
         // for now:
         assert(((nodeptr)stm_read_barrier((gcptr)r_prev->next))->value 
                == r_current->value


More information about the pypy-commit mailing list