[pypy-commit] pypy stmgc-c8: try harder to not call rgil.acquire() in STM

Raemi pypy.commits at gmail.com
Mon Feb 22 13:07:57 EST 2016


Author: Remi Meier <remi.meier at gmail.com>
Branch: stmgc-c8
Changeset: r82409:6de86a868686
Date: 2016-02-22 19:07 +0100
http://bitbucket.org/pypy/pypy/changeset/6de86a868686/

Log:	try harder to not call rgil.acquire() in STM

diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py
--- a/pypy/module/_cffi_backend/call_python.py
+++ b/pypy/module/_cffi_backend/call_python.py
@@ -40,8 +40,10 @@
        at least 8 bytes in size.
     """
     from pypy.module._cffi_backend.ccallback import reveal_callback
-    from rpython.rlib import rgil
+    from rpython.rlib import rgil, rgc
 
+    if rgc.stm_is_enabled():
+        raise NotImplementedError("XXX for STM")
     rgil.acquire()
     rffi.stackcounter.stacks_counter += 1
     llop.gc_stack_bottom(lltype.Void)   # marker for trackgcroot.py
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -602,7 +602,7 @@
 # Make the wrapper for the cases (1) and (2)
 def make_wrapper(space, callable, gil=None):
     "NOT_RPYTHON"
-    from rpython.rlib import rgil
+    from rpython.rlib import rgil, rgc
     names = callable.api_func.argnames
     argtypes_enum_ui = unrolling_iterable(enumerate(zip(callable.api_func.argtypes,
         [name.startswith("w_") for name in names])))
@@ -618,6 +618,8 @@
         # we hope that malloc removal removes the newtuple() that is
         # inserted exactly here by the varargs specializer
         if gil_acquire:
+            if rgc.stm_is_enabled():
+                raise NotImplementedError("XXX for STM")
             rgil.acquire()
         rffi.stackcounter.stacks_counter += 1
         llop.gc_stack_bottom(lltype.Void)   # marker for trackgcroot.py
diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -56,10 +56,12 @@
     """
     def deco(func):
         source = py.code.Source("""
-        from rpython.rlib import rgil
+        from rpython.rlib import rgil,rgc
 
         def wrapper(%(args)s):
             # acquire the GIL
+            if rgc.stm_is_enabled():
+                raise NotImplementedError("XXX for STM")
             rgil.acquire()
             #
             rffi.stackcounter.stacks_counter += 1


More information about the pypy-commit mailing list