[pypy-svn] r17064 - in pypy/dist/pypy/translator/c: . src
ericvrp at codespeak.net
ericvrp at codespeak.net
Mon Aug 29 20:40:27 CEST 2005
Author: ericvrp
Date: Mon Aug 29 20:40:26 2005
New Revision: 17064
Modified:
pypy/dist/pypy/translator/c/gc.py
pypy/dist/pypy/translator/c/src/mem.h
Log:
Added usage of _is_atomic for increased speed execution-speed in genc.
Modified: pypy/dist/pypy/translator/c/gc.py
==============================================================================
--- pypy/dist/pypy/translator/c/gc.py (original)
+++ pypy/dist/pypy/translator/c/gc.py Mon Aug 29 20:40:26 2005
@@ -334,15 +334,18 @@
def zero_malloc(self, TYPE, esize, eresult, err):
gcinfo = self.db.gettypedefnode(TYPE).gcinfo
+ atomic = ['','_ATOMIC'][TYPE._is_atomic()]
if gcinfo and gcinfo.finalizer:
- return 'OP_BOEHM_ZERO_MALLOC_FINALIZER(%s, %s, %s, %s);' % (esize,
- eresult,
- gcinfo.finalizer,
- err)
+ yield 'OP_BOEHM_ZERO_MALLOC_FINALIZER(%s, %s, %s, %s, %s);' % (esize,
+ eresult,
+ atomic,
+ gcinfo.finalizer,
+ err)
else:
- return 'OP_BOEHM_ZERO_MALLOC(%s, %s, %s);' % (esize,
- eresult,
- err)
+ yield 'OP_BOEHM_ZERO_MALLOC(%s, %s, %s, %s);' % (esize,
+ eresult,
+ atomic,
+ err)
def gc_libraries(self):
return ['gc'] # xxx on windows?
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 Mon Aug 29 20:40:26 2005
@@ -49,14 +49,14 @@
#ifdef USING_BOEHM_GC
-#define OP_BOEHM_ZERO_MALLOC(size, r, err) { \
- r = (void*) GC_MALLOC(size); \
+#define OP_BOEHM_ZERO_MALLOC(size, r, atomic, err) { \
+ r = (void*) GC_MALLOC##atomic(size); \
if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory"); \
memset((void*) r, 0, size); \
}
-#define OP_BOEHM_ZERO_MALLOC_FINALIZER(size, r, finalizer, err) { \
- r = (void*) GC_MALLOC(size); \
+#define OP_BOEHM_ZERO_MALLOC_FINALIZER(size, r, atomic, finalizer, err) { \
+ r = (void*) GC_MALLOC##atomic(size); \
if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory"); \
GC_REGISTER_FINALIZER(r, finalizer, NULL, NULL, NULL); \
memset((void*) r, 0, size); \
More information about the Pypy-commit
mailing list