Commits

Armin Rigo committed 041f5c2

Yay, targetdemo2 passes

Comments (0)

Files changed (7)

rpython/memory/gctransform/stmframework.py

     def gc_header_for(self, obj, needs_hash=False):
         return self.gcdata.gc.gcheaderbuilder.header_of_object(obj)
 
+    def _gct_with_roots_pushed(self, hop):
+        livevars = self.push_roots(hop)
+        self.default(hop)
+        self.pop_roots(hop, livevars)
+
+    gct_stm_become_inevitable   = _gct_with_roots_pushed
+    gct_stm_perform_transaction = _gct_with_roots_pushed
+
 
 class StmRootWalker(BaseRootWalker):
 
     def need_thread_support(self, gctransformer, getfn):
+        # gc_thread_start() and gc_thread_die() don't need to become
+        # anything.  When a new thread start, there is anyway first
+        # the "after/before" callbacks from rffi, which contain calls
+        # to "stm_enter_callback_call/stm_leave_callback_call".
         pass
 
     def walk_stack_roots(self, collect_stack_root):

rpython/rtyper/lltypesystem/lloperation.py

     'stm_initialize':         LLOp(),
     'stm_finalize':           LLOp(),
     'stm_barrier':            LLOp(sideeffects=False),
-    'stm_allocate':           LLOp(sideeffects=False),
-    'stm_become_inevitable':  LLOp(),
-    'stm_minor_collect':      LLOp(),
-    'stm_major_collect':      LLOp(),
+    'stm_allocate':           LLOp(sideeffects=False, canmallocgc=True),
+    'stm_become_inevitable':  LLOp(canmallocgc=True),
+    'stm_minor_collect':      LLOp(canmallocgc=True),
+    'stm_major_collect':      LLOp(canmallocgc=True),
     'stm_get_tid':            LLOp(canfold=True),
     'stm_ptr_eq':             LLOp(canfold=True),
     'stm_id':                 LLOp(sideeffects=False),
     'stm_set_transaction_length': LLOp(),
     'stm_change_atomic':      LLOp(),
     'stm_get_atomic':         LLOp(sideeffects=False),
-    'stm_perform_transaction':LLOp(),
+    'stm_perform_transaction':LLOp(canmallocgc=True),
     'stm_enter_callback_call':LLOp(),
     'stm_leave_callback_call':LLOp(),
 

rpython/translator/stm/jitdriver.py

     #             store (green args, red args) into p
     #             return 1     # causes perform_tr() to loop and call us again
     #     p.result_value = result_value
-    #     p.got_exception = NULL
     #     return 0         # stop perform_tr() and returns
 
     def __init__(self, stmtransformer, graph):
         blockst.closeblock(Link(a_vars, link.target))
         #
         # hack at the regular return block, to set the result into
-        # 'p.result_value', clear 'p.got_exception', and return 0
+        # 'p.result_value' and return 0.  Note that 'p.got_exception'
+        # is already cleared.
         blockr = callback_graph.returnblock
         c_result_value = Constant('result_value', lltype.Void)
-        c_got_exception = Constant('got_exception', lltype.Void)
-        c_null = Constant(lltype.nullptr(self.CONTAINER.got_exception.TO),
-                          self.CONTAINER.got_exception)
         v_p = self.container_var()
         renamed_p[blockr] = v_p
         blockr.operations = [
             SpaceOperation('setfield',
                            [v_p, c_result_value, blockr.inputargs[0]],
                            varoftype(lltype.Void)),
-            SpaceOperation('setfield',
-                           [v_p, c_got_exception, c_null],
-                           varoftype(lltype.Void)),
             ]
         v = varoftype(lltype.Signed)
         annotator.setbinding(v, s_Int)

rpython/translator/stm/stmgcintf.py

 cdir = os.path.abspath(os.path.join(cdir2, '..', 'stm'))
 
 separate_source = '''
-#define _GC_DEBUG   2       /* XXX move elsewhere */
+//#define _GC_DEBUG   2       /* XXX move elsewhere */
 
 #include "src_stm/stmgc.h"
 

rpython/translator/stm/test/support.py

         # Prevent the RaiseAnalyzer from just emitting "WARNING: Unknown
         # operation".  We want instead it to crash.
         from rpython.translator.backendopt.canraise import RaiseAnalyzer
-        RaiseAnalyzer.fail_on_unknown_operation = True
+        prev_setting = RaiseAnalyzer.fail_on_unknown_operation
         try:
+            RaiseAnalyzer.fail_on_unknown_operation = True
             res = StandaloneTests.compile(self, entry_point, debug=True,
                                           **kwds)
         finally:
-            RaiseAnalyzer.fail_on_unknown_operation = False
+            RaiseAnalyzer.fail_on_unknown_operation = prev_setting
         return res

rpython/translator/stm/test/targetdemo2.py

 def setup_threads():
     #space.threadlocals.setup_threads(space)
     bootstrapper.setup()
-    rstm.invoke_around_extcall()
 
 def start_thread(args):
     bootstrapper.acquire(args)

rpython/translator/stm/test/test_ztranslated.py

 
     def test_targetdemo(self):
         t, cbuilder = self.compile(targetdemo2.entry_point)
-        data, dataerr = cbuilder.cmdexec('4 5000', err=True,
-                                         env={'PYPY_GC_DEBUG': '1'})
+        data, dataerr = cbuilder.cmdexec('4 5000', err=True)
         assert 'check ok!' in data
 
     def test_bug1(self):