Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r66890:5ea162371f3f
Date: 2013-09-10 11:07 +0200
http://bitbucket.org/pypy/pypy/changeset/5ea162371f3f/

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

diff --git a/rpython/jit/backend/llsupport/llmodel.py 
b/rpython/jit/backend/llsupport/llmodel.py
--- a/rpython/jit/backend/llsupport/llmodel.py
+++ b/rpython/jit/backend/llsupport/llmodel.py
@@ -182,6 +182,7 @@
         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)
diff --git a/rpython/jit/backend/x86/assembler.py 
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -315,6 +315,8 @@
             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)
diff --git a/rpython/rlib/rstack.py b/rpython/rlib/rstack.py
--- a/rpython/rlib/rstack.py
+++ b/rpython/rlib/rstack.py
@@ -23,6 +23,7 @@
 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,
@@ -34,24 +35,30 @@
                                         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
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to