Commits

Armin Rigo committed e68bd4b

Call invoke_around_extcall() automatically with stm.

  • Participants
  • Parent commits f0f5f39
  • Branches stmgc-c4

Comments (0)

Files changed (4)

rpython/rlib/rstm.py

 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)

rpython/rlib/rthread.py

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

rpython/translator/c/genc.py

         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:

rpython/translator/stm/test/test_ztranslated.py

             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: