[pypy-commit] pypy stm-thread-2: stm: make more functions transactionsafe [copied from meierrem on

arigo noreply at buildbot.pypy.org
Tue Dec 11 16:08:25 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r59401:7bcb458e12ce
Date: 2012-12-11 16:03 +0100
http://bitbucket.org/pypy/pypy/changeset/7bcb458e12ce/

Log:	stm: make more functions transactionsafe [copied from meierrem on
	stm-logging]

diff --git a/pypy/rlib/rdtoa.py b/pypy/rlib/rdtoa.py
--- a/pypy/rlib/rdtoa.py
+++ b/pypy/rlib/rdtoa.py
@@ -40,7 +40,8 @@
 
 dg_strtod = rffi.llexternal(
     '_PyPy_dg_strtod', [rffi.CCHARP, rffi.CCHARPP], rffi.DOUBLE,
-    compilation_info=eci, sandboxsafe=True)
+    compilation_info=eci, sandboxsafe=True,
+    transactionsafe=True)
 
 dg_dtoa = rffi.llexternal(
     '_PyPy_dg_dtoa', [rffi.DOUBLE, rffi.INT, rffi.INT,
diff --git a/pypy/rlib/rposix.py b/pypy/rlib/rposix.py
--- a/pypy/rlib/rposix.py
+++ b/pypy/rlib/rposix.py
@@ -92,7 +92,8 @@
 
 _get_errno, _set_errno = CExternVariable(INT, 'errno', errno_eci,
                                          CConstantErrno, sandboxsafe=True,
-                                         _nowrapper=True, c_type='int')
+                                         _nowrapper=True, c_type='int',
+                                         transactionsafe=True)
 # the default wrapper for set_errno is not suitable for use in critical places
 # like around GIL handling logic, so we provide our own wrappers.
 
@@ -252,4 +253,4 @@
     os_kill = rwin32.os_kill
 else:
     os_kill = os.kill
-    
+
diff --git a/pypy/rpython/lltypesystem/module/ll_math.py b/pypy/rpython/lltypesystem/module/ll_math.py
--- a/pypy/rpython/lltypesystem/module/ll_math.py
+++ b/pypy/rpython/lltypesystem/module/ll_math.py
@@ -43,12 +43,13 @@
 
 def llexternal(name, ARGS, RESULT, **kwargs):
     return rffi.llexternal(name, ARGS, RESULT, compilation_info=eci,
-                           sandboxsafe=True, **kwargs)
+                           sandboxsafe=True, transactionsafe=True,
+                           **kwargs)
 
 def math_llexternal(name, ARGS, RESULT):
     return rffi.llexternal(math_prefix + name, ARGS, RESULT,
                            compilation_info=math_eci,
-                           sandboxsafe=True)
+                           sandboxsafe=True, transactionsafe=True)
 
 if sys.platform == 'win32':
     underscore = '_'
diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -590,7 +590,7 @@
 
 def CExternVariable(TYPE, name, eci, _CConstantClass=CConstant,
                     sandboxsafe=False, _nowrapper=False,
-                    c_type=None):
+                    c_type=None, transactionsafe=False):
     """Return a pair of functions - a getter and a setter - to access
     the given global C variable.
     """
@@ -630,10 +630,12 @@
     ))
 
     getter = llexternal(getter_name, [], TYPE, compilation_info=new_eci,
-                        sandboxsafe=sandboxsafe, _nowrapper=_nowrapper)
+                        sandboxsafe=sandboxsafe, _nowrapper=_nowrapper,
+                        transactionsafe=transactionsafe)
     setter = llexternal(setter_name, [TYPE], lltype.Void,
                         compilation_info=new_eci, sandboxsafe=sandboxsafe,
-                        _nowrapper=_nowrapper)
+                        _nowrapper=_nowrapper,
+                        transactionsafe=transactionsafe)
     return getter, setter
 
 # char, represented as a Python character
diff --git a/pypy/translator/c/src/dtoa.c b/pypy/translator/c/src/dtoa.c
--- a/pypy/translator/c/src/dtoa.c
+++ b/pypy/translator/c/src/dtoa.c
@@ -326,6 +326,12 @@
 
 typedef struct Bigint Bigint;
 
+#define Py_USING_MEMORY_DEBUGGER /* Set to use thread-safe malloc, free */
+#undef MALLOC
+#undef FREE
+#define MALLOC malloc /* use thread-safe malloc/free */
+#define FREE free
+
 #ifndef Py_USING_MEMORY_DEBUGGER
 
 /* Memory management: memory is allocated from, and returned to, Kmax+1 pools


More information about the pypy-commit mailing list