[pypy-commit] pypy stmgc-c4: Call invoke_around_extcall() automatically with stm.

arigo noreply at buildbot.pypy.org
Mon Jul 1 17:21:07 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c4
Changeset: r65143:e68bd4bac940
Date: 2013-07-01 17:20 +0200
http://bitbucket.org/pypy/pypy/changeset/e68bd4bac940/

Log:	Call invoke_around_extcall() automatically with stm.

diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py
--- a/rpython/rlib/rstm.py
+++ b/rpython/rlib/rstm.py
@@ -56,8 +56,9 @@
 leave_callback_call._dont_reach_me_in_del_ = True
 leave_callback_call._transaction_break_ = True
 
-def invoke_around_extcall():
-    """Initialize the STM system.  Must be called once from the start-up."""
+def register_invoke_around_extcall():
+    """Initialize the STM system.
+    Called automatically by rthread.start_new_thread()."""
     from rpython.rlib.objectmodel import invoke_around_extcall
     invoke_around_extcall(before_external_call, after_external_call,
                           enter_callback_call, leave_callback_call)
diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -97,6 +97,9 @@
 
 @specialize.arg(0)
 def ll_start_new_thread(func):
+    if rgc.stm_is_enabled:
+        from rpython.rlib.rstm import register_invoke_around_extcall
+        register_invoke_around_extcall()
     ident = c_thread_start(func)
     if ident == -1:
         raise error("can't start new thread")
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -331,13 +331,8 @@
         from rpython.rtyper.lltypesystem import rffi
         from rpython.rtyper.annlowlevel import MixLevelHelperAnnotator
         entrypoint = self.entrypoint
-        stm_nogc = (self.config.translation.stm and
-                    self.config.translation.gc == "none")
         #
         def entrypoint_wrapper(argc, argv):
-            if stm_nogc:
-                from rpython.translator.stm.funcgen import _stm_nogc_init_function
-                _stm_nogc_init_function()
             list = [""] * argc
             i = 0
             while i < argc:
diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -66,7 +66,6 @@
             x.value = 0
             glob.seen = x
         def entry_point(argv):
-            rstm.invoke_around_extcall()
             glob.seen = None
             rthread.start_new_thread(threadfn, ())
             while glob.seen is None:


More information about the pypy-commit mailing list