Commits

Armin Rigo committed 45ec64b

Fix.

  • Participants
  • Parent commits 0a02223
  • Branches stm-gc

Comments (0)

Files changed (2)

File pypy/rpython/memory/gctransform/stmframework.py

             gc.teardown_thread()
             self.root_walker.free_shadow_stack()
         #
+        def start_transaction(gc):
+            self.root_walker.start_transaction()
+            gc.start_transaction()
+        #
         super(StmFrameworkGCTransformer, self)._declare_functions(
             GCClass, getfn, s_gc, *args)
         self.thread_starting_ptr = getfn(
             self.gcdata.gc.leave_transactional_mode.im_func,
             [s_gc], annmodel.s_None)
         self.stm_start_ptr = getfn(
-            self.gcdata.gc.start_transaction.im_func,
+            start_transaction,
             [s_gc], annmodel.s_None)
         self.stm_stop_ptr = getfn(
             self.gcdata.gc.stop_transaction.im_func,
         base = self.stackgcdata.root_stack_base
         llmemory.raw_free(base)
 
+    def start_transaction(self):
+        # When a transaction is aborted, it leaves behind its shadow
+        # stack content.  We have to clear it here.
+        stackgcdata = self.stackgcdata
+        stackgcdata.root_stack_top = stackgcdata.root_stack_base
+
     def walk_stack_roots(self, collect_stack_root):
         raise NotImplementedError
         # XXX only to walk the main thread's shadow stack, so far

File pypy/translator/stm/test/test_ztranslated.py

     def test_hello_world(self):
         t, cbuilder = self.compile(targetdemo.entry_point)
         data, dataerr = cbuilder.cmdexec('4 5000', err=True)
-        assert 'done sleeping.' in dataerr
         assert 'check ok!' in data
 
     def test_bug1(self):