[pypy-svn] r51411 - in pypy/dist/pypy/translator/c: . src

arigo at codespeak.net arigo at codespeak.net
Tue Feb 12 14:57:07 CET 2008


Author: arigo
Date: Tue Feb 12 14:57:06 2008
New Revision: 51411

Added:
   pypy/dist/pypy/translator/c/src/linuxmemchk.c
      - copied, changed from r51353, psyco/dist/c/linuxmemchk.c
Modified:
   pypy/dist/pypy/translator/c/genc.py
   pypy/dist/pypy/translator/c/src/standalone.h
Log:
Copy linuxmemchk.c from Psyco.  To use it, run "make linuxmemchk" with
the Makefile produced by genc.



Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py	(original)
+++ pypy/dist/pypy/translator/c/genc.py	Tue Feb 12 14:57:06 2008
@@ -848,8 +848,14 @@
 \t$(MAKE) CFLAGS="-g -DRPY_ASSERT -DDO_LOG_EXC"
 
 debug_mem:
+\t$(MAKE) CFLAGS="-g -DRPY_ASSERT -DTRIVIAL_MALLOC_DEBUG"
+
+no_obmalloc:
 \t$(MAKE) CFLAGS="-g -DRPY_ASSERT -DNO_OBMALLOC"
 
+linuxmemchk:
+\t$(MAKE) CFLAGS="-g -DRPY_ASSERT -DLINUXMEMCHK"
+
 llsafer:
 \t$(MAKE) CFLAGS="-O2 -DRPY_LL_ASSERT"
 

Modified: pypy/dist/pypy/translator/c/src/standalone.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/standalone.h	(original)
+++ pypy/dist/pypy/translator/c/src/standalone.h	Tue Feb 12 14:57:06 2008
@@ -10,15 +10,26 @@
      #define NO_OBMALLOC
    #endif
 #endif
-#ifdef NO_OBMALLOC
-void *PyObject_Malloc(size_t n) { return malloc(n); }
-void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n); }
-void PyObject_Free(void *p) { if (p) { *((int*)p) = 0xDDDDDDDD; } free(p); }
+
+#if defined(TRIVIAL_MALLOC_DEBUG)
+  void *PyObject_Malloc(size_t n) { return malloc(n); }
+  void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n); }
+  void PyObject_Free(void *p) { if (p) { *((int*)p) = 0xDDDDDDDD; } free(p); }
+
+#elif defined(LINUXMEMCHK)
+#  include "linuxmemchk.c"
+
+#elif defined(NO_OBMALLOC)
+  void *PyObject_Malloc(size_t n) { return malloc(n); }
+  void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n); }
+  void PyObject_Free(void *p) { free(p); }
+
 #else
 #  ifndef WITH_PYMALLOC
 #    define WITH_PYMALLOC
 #  endif
 #  include "obmalloc.c"
+
 #endif
 
 #endif



More information about the Pypy-commit mailing list