[pypy-commit] stmgc default: Add asserts, tweak debug prints

arigo noreply at buildbot.pypy.org
Tue Oct 8 07:16:32 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r535:9149deb7e746
Date: 2013-10-08 07:16 +0200
http://bitbucket.org/pypy/stmgc/changeset/9149deb7e746/

Log:	Add asserts, tweak debug prints

diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -6,9 +6,9 @@
  */
 #include "stmimpl.h"
 
-char tmp_buf[128];
 char* stm_dbg_get_hdr_str(gcptr obj)
 {
+    static char tmp_buf[128];
     char *cur;
     char *flags[] = GC_FLAG_NAMES;
     int i;
@@ -43,8 +43,10 @@
         struct tx_descriptor *d = stm_tx_head;
         while (d && d->public_descriptor != pd)
             d = d->tx_next;
-        if (!d)
+        if (!d) {
+            fprintf(stderr, "\n");
             continue;
+        }
 
         fprintf(stderr, "((struct tx_descriptor *)\033[%dm%p\033[0m)\n"
                 "pthread_self = 0x%lx\n\n", d->tcolor, d, (long)d->pthreadid);
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -512,6 +512,9 @@
     }
     else {
         d->nursery_cleared = NC_REGULAR;
+#if defined(_GC_DEBUG)
+        memset(d->nursery_current, 0xEE, d->nursery_end - d->nursery_current);
+#endif
     }
 
     /* if in debugging mode, we allocate a different nursery and make
diff --git a/c4/steal.c b/c4/steal.c
--- a/c4/steal.c
+++ b/c4/steal.c
@@ -193,6 +193,7 @@
             if (L->h_tid & GCFLAG_HAS_ID) {
                 /* use id-copy for us */
                 O = (gcptr)L->h_original;
+                assert(O != L);
                 L->h_tid &= ~GCFLAG_HAS_ID;
                 stm_copy_to_old_id_copy(L, O);
                 O->h_original = 0;
@@ -200,6 +201,7 @@
                 /* Copy the object out of the other thread's nursery, 
                    if needed */
                 O = stmgc_duplicate_old(L);
+                assert(O != L);
 
                 /* young and without original? */
                 if (!(L->h_original))


More information about the pypy-commit mailing list