[pypy-commit] pypy stm-gc: Fix.

arigo noreply at buildbot.pypy.org
Sun Apr 22 19:28:17 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r54625:45ec64b5f8c8
Date: 2012-04-22 19:27 +0200
http://bitbucket.org/pypy/pypy/changeset/45ec64b5f8c8/

Log:	Fix.

diff --git a/pypy/rpython/memory/gctransform/stmframework.py b/pypy/rpython/memory/gctransform/stmframework.py
--- a/pypy/rpython/memory/gctransform/stmframework.py
+++ b/pypy/rpython/memory/gctransform/stmframework.py
@@ -21,6 +21,10 @@
             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(
@@ -42,7 +46,7 @@
             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,
@@ -172,6 +176,12 @@
         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
diff --git a/pypy/translator/stm/test/test_ztranslated.py b/pypy/translator/stm/test/test_ztranslated.py
--- a/pypy/translator/stm/test/test_ztranslated.py
+++ b/pypy/translator/stm/test/test_ztranslated.py
@@ -8,7 +8,6 @@
     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):


More information about the pypy-commit mailing list