[pypy-commit] pypy default: Add a check (for lldebug builds) which points directly to where we forget to close the stack.
arigo
noreply at buildbot.pypy.org
Thu Apr 4 19:50:54 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r63013:82b07e9f1053
Date: 2013-04-04 19:52 +0200
http://bitbucket.org/pypy/pypy/changeset/82b07e9f1053/
Log: Add a check (for lldebug builds) which points directly to where we
forget to close the stack.
diff --git a/rpython/translator/c/src/mem.h b/rpython/translator/c/src/mem.h
--- a/rpython/translator/c/src/mem.h
+++ b/rpython/translator/c/src/mem.h
@@ -195,8 +195,24 @@
"g" (v))
/* marker for trackgcroot.py, and inhibits tail calls */
-#define pypy_asm_stack_bottom() asm volatile ("/* GC_STACK_BOTTOM */" : : : \
- "memory")
+#define pypy_asm_stack_bottom() { asm volatile ("/* GC_STACK_BOTTOM */" : : : \
+ "memory"); pypy_check_stack_count(); }
+
+static void pypy_check_stack_count(void)
+{
+#ifdef RPY_ASSERT
+ void *anchor = (void*)&pypy_g_ASM_FRAMEDATA_HEAD;
+ void *fd = ((void* *) (((char *)anchor) + sizeof(void*)))[0];
+ long got = 0;
+ long stacks_counter =
+ (&pypy_g_rpython_rtyper_lltypesystem_rffi_StackCounter)->sc_inst_stacks_counter;
+ while (fd != anchor) {
+ got += 1;
+ fd = ((void* *) (((char *)fd) + sizeof(void*)))[0];
+ }
+ assert(got == stacks_counter || ((got == 0) && (stacks_counter == 1)));
+#endif
+}
#define OP_GC_ASMGCROOT_STATIC(i, r) r = \
i == 0 ? (void*)&__gcmapstart : \
More information about the pypy-commit
mailing list