Commits

Armin Rigo committed 7bcb458

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

Comments (0)

Files changed (5)

pypy/rlib/rdtoa.py

 
 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,

pypy/rlib/rposix.py

 
 _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.
 
     os_kill = rwin32.os_kill
 else:
     os_kill = os.kill
-    
+

pypy/rpython/lltypesystem/module/ll_math.py

 
 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 = '_'

pypy/rpython/lltypesystem/rffi.py

 
 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.
     """
     ))
 
     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

pypy/translator/c/src/dtoa.c

 
 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