Commits

Armin Rigo committed 5ea1623

Disable stack-checking "more", with STM. In particular, avoid
calls to LL_stack_criticalcode_start(), turning the transaction
inevitable.

Comments (0)

Files changed (3)

rpython/jit/backend/llsupport/llmodel.py

         STACK_CHECK_SLOWPATH = lltype.Ptr(lltype.FuncType([lltype.Signed],
                                                           lltype.Void))
         def insert_stack_check():
+            assert not self.cpu.gc_ll_descr.stm
             endaddr = rstack._stack_get_end_adr()
             lengthaddr = rstack._stack_get_length_adr()
             f = llhelper(STACK_CHECK_SLOWPATH, rstack.stack_check_slowpath)

rpython/jit/backend/x86/assembler.py

             stmtlocal.tl_segment_prefix(mc)
         
     def _build_stack_check_slowpath(self):
+        if self.cpu.gc_ll_descr.stm:
+            return      # XXX no stack check on STM for now
         _, _, slowpathaddr = self.cpu.insert_stack_check()
         if slowpathaddr == 0 or not self.cpu.propagate_exception_descr:
             return      # no stack check (for tests, or non-translated)

rpython/rlib/rstack.py

 def llexternal(name, args, res, _callable=None, **kwds):
     return rffi.llexternal(name, args, res, compilation_info=compilation_info,
                            sandboxsafe=True, _nowrapper=True,
+                           transactionsafe=True,
                            _callable=_callable, **kwds)
 
 _stack_get_end = llexternal('LL_stack_get_end', [], lltype.Signed,
                                         lambda frac: None)
 _stack_too_big_slowpath = llexternal('LL_stack_too_big_slowpath',
                                      [lltype.Signed], lltype.Char,
-                                     lambda cur: '\x00',
-                                     transactionsafe=True)
+                                     lambda cur: '\x00')
 # the following is used by the JIT
 _stack_get_end_adr   = llexternal('LL_stack_get_end_adr',   [], lltype.Signed)
 _stack_get_length_adr= llexternal('LL_stack_get_length_adr',[], lltype.Signed)
 
 # the following is also used by the JIT: "critical code" paths are paths in
 # which we should not raise StackOverflow at all, but just ignore the stack limit
-_stack_criticalcode_start = llexternal('LL_stack_criticalcode_start', [],
-                                       lltype.Void, lambda: None)
-_stack_criticalcode_stop = llexternal('LL_stack_criticalcode_stop', [],
-                                      lltype.Void, lambda: None)
+_LL_stack_criticalcode_start = llexternal('LL_stack_criticalcode_start', [],
+                                          lltype.Void)
+_LL_stack_criticalcode_stop = llexternal('LL_stack_criticalcode_stop', [],
+                                         lltype.Void)
+def _stack_criticalcode_start():
+    if we_are_translated() and not rgc.stm_is_enabled():
+        _LL_stack_criticalcode_start()
+def _stack_criticalcode_stop():
+    if we_are_translated() and not rgc.stm_is_enabled():
+        _LL_stack_criticalcode_stop()
+
 
 def stack_check():
     if not we_are_translated():
         return
-    # XXX --- custom version for STM ---
-    return  # ignore
+    if rgc.stm_is_enabled():
+        return  # XXX ignore if we use STM
     #
     # Load the "current" stack position, or at least some address that
     # points close to the current stack head