[pypy-commit] pypy stmgc-c4: Make the __thread in these files only appear in stm mode.
arigo
noreply at buildbot.pypy.org
Fri Sep 6 22:31:35 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c4
Changeset: r66823:bb1e13c5f0d1
Date: 2013-09-06 22:25 +0200
http://bitbucket.org/pypy/pypy/changeset/bb1e13c5f0d1/
Log: Make the __thread in these files only appear in stm mode.
diff --git a/rpython/translator/c/src/debug_print.c b/rpython/translator/c/src/debug_print.c
--- a/rpython/translator/c/src/debug_print.c
+++ b/rpython/translator/c/src/debug_print.c
@@ -15,13 +15,13 @@
#include "src/profiling.h"
#include "src/debug_print.h"
-__thread long pypy_have_debug_prints = -1;
+__thread_if_stm long pypy_have_debug_prints = -1;
FILE *pypy_debug_file = NULL; /* XXX make it thread-local too? */
static unsigned char debug_ready = 0;
static unsigned char debug_profile = 0;
-__thread char debug_start_colors_1[32];
-__thread char debug_start_colors_2[28];
-__thread char pypy_debug_threadid[16];
+__thread_if_stm static char debug_start_colors_1[32];
+__thread_if_stm static char debug_start_colors_2[28];
+__thread_if_stm char pypy_debug_threadid[16] = {0};
static char *debug_stop_colors = "";
static char *debug_prefix = NULL;
static char *debug_filename = NULL;
@@ -184,7 +184,9 @@
/* not a tty output: no colors */
sprintf(debug_start_colors_1, "%d# ", (int)counter);
sprintf(debug_start_colors_2, "%d# ", (int)counter);
+#ifdef RPY_STM
sprintf(pypy_debug_threadid, "%d#", (int)counter);
+#endif
}
else {
/* tty output */
@@ -200,8 +202,10 @@
color, (int)counter);
sprintf(debug_start_colors_2, "\033[%dm%d# ",
color, (int)counter);
+#ifdef RPY_STM
sprintf(pypy_debug_threadid, "\033[%dm%d#\033[0m",
color, (int)counter);
+#endif
}
}
diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h
--- a/rpython/translator/c/src/debug_print.h
+++ b/rpython/translator/c/src/debug_print.h
@@ -42,8 +42,14 @@
long pypy_debug_offset(void);
void pypy_debug_forked(long original_offset);
-extern __thread long pypy_have_debug_prints;
-extern __thread char pypy_debug_threadid[];
+#ifdef RPY_STM
+#define __thread_if_stm __thread
+#else
+#define __thread_if_stm /* nothing */
+#endif
+
+extern __thread_if_stm long pypy_have_debug_prints;
+extern __thread_if_stm char pypy_debug_threadid[];
extern FILE *pypy_debug_file;
#define OP_LL_READ_TIMESTAMP(val) READ_TIMESTAMP(val)
More information about the pypy-commit
mailing list