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

arigo noreply at buildbot.pypy.org
Tue Apr 24 19:23:20 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r54729:a3c0cada9e2c
Date: 2012-04-24 17:44 +0200
http://bitbucket.org/pypy/pypy/changeset/a3c0cada9e2c/

Log:	Fixes.

diff --git a/pypy/module/transaction/interp_transaction.py b/pypy/module/transaction/interp_transaction.py
--- a/pypy/module/transaction/interp_transaction.py
+++ b/pypy/module/transaction/interp_transaction.py
@@ -116,14 +116,20 @@
         NOTE: never register() the same instance multiple times.
         """
         ec = self.state.getvalue()
+        assert ec is not None       # must have been created first
         ec._transaction_pending.append(self)
 
     def run(self):
+        ec = self.space.getexecutioncontext()    # create it if needed
+        #
         if self.retry_counter > 0:
+            # Note that even in this case we have to ensure the ec is
+            # created first.  Otherwise, if the first transaction of a
+            # thread is retrying, the creation of the ec is cancelled
+            # and we end up in register() with no ec...
             self.register() # retrying: will be done later, try others first
             return
         #
-        ec = self.space.getexecutioncontext()    # create it if needed
         assert len(ec._transaction_pending) == 0
         #
         self.space.call_args(self.w_callback, self.args)
diff --git a/pypy/rpython/memory/gc/stmtls.py b/pypy/rpython/memory/gc/stmtls.py
--- a/pypy/rpython/memory/gc/stmtls.py
+++ b/pypy/rpython/memory/gc/stmtls.py
@@ -297,9 +297,9 @@
 
     def main_thread_writes_to_global_obj(self, obj):
         hdr = self.gc.header(obj)
-        ll_assert(hdr.tid & (GCFLAG_WAS_COPIED|GCFLAG_VISITED) == 0,
-                  "write in main thread: unexpected GCFLAG_WAS_COPIED"
-                  " or GCFLAG_VISITED")
+        # XXX should we also remove GCFLAG_WAS_COPIED here if it is set?
+        ll_assert(hdr.tid & GCFLAG_VISITED == 0,
+                  "write in main thread: unexpected GCFLAG_VISITED")
         # remove GCFLAG_GLOBAL, and add GCFLAG_VISITED
         hdr.tid += (GCFLAG_VISITED - GCFLAG_GLOBAL)
         # add the object into this linked list


More information about the pypy-commit mailing list