[pypy-svn] r27307 - pypy/dist/pypy/translator/c/src
arigo at codespeak.net
arigo at codespeak.net
Tue May 16 23:12:49 CEST 2006
Author: arigo
Date: Tue May 16 23:12:48 2006
New Revision: 27307
Modified:
pypy/dist/pypy/translator/c/src/address.h
pypy/dist/pypy/translator/c/src/mem.h
Log:
(arigo, pedronis)
obscure, raw_malloc which is used by our framework gc
was not really using obmalloc as we expected.
obscure fix and move the RAW ops to mem.h
Modified: pypy/dist/pypy/translator/c/src/address.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/address.h (original)
+++ pypy/dist/pypy/translator/c/src/address.h Tue May 16 23:12:48 2006
@@ -16,20 +16,3 @@
#define OP_ADR_LT(x,y,r) r = ((x) < (y))
#define OP_ADR_GE(x,y,r) r = ((x) >= (y))
-#define OP_RAW_MALLOC(size,r) \
- r = (void*) calloc(1, size); \
- if (r == NULL) FAIL_EXCEPTION( PyExc_MemoryError, "out of memory");\
-
-#define OP_RAW_MALLOC_USAGE(size, r) r = size
-
-#ifdef MS_WINDOWS
-#define alloca _alloca
-#endif
-
-#define OP_STACK_MALLOC(size,r) \
- r = (void*) alloca(size); \
- if (r == NULL) FAIL_EXCEPTION(PyExc_MemoryError, "out of memory");\
-
-#define OP_RAW_FREE(x,r) free(x);
-#define OP_RAW_MEMCOPY(x,y,size,r) memcpy(y,x,size);
-
Modified: pypy/dist/pypy/translator/c/src/mem.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/mem.h (original)
+++ pypy/dist/pypy/translator/c/src/mem.h Tue May 16 23:12:48 2006
@@ -2,6 +2,22 @@
/************************************************************/
/*** C header subsection: operations on LowLevelTypes ***/
+#define OP_RAW_MALLOC(size,r) OP_ZERO_MALLOC(size, r)
+
+#define OP_RAW_MALLOC_USAGE(size, r) r = size
+
+#ifdef MS_WINDOWS
+#define alloca _alloca
+#endif
+
+#define OP_STACK_MALLOC(size,r) \
+ r = (void*) alloca(size); \
+ if (r == NULL) FAIL_EXCEPTION(PyExc_MemoryError, "out of memory");\
+
+#define OP_RAW_FREE(x,r) OP_FREE(x)
+#define OP_RAW_MEMCOPY(x,y,size,r) memcpy(y,x,size);
+
+/************************************************************/
/* a reasonably safe bound on the largest allowed argument value
that we can pass to malloc. This is used for var-sized mallocs
More information about the Pypy-commit
mailing list