Author: Armin Rigo <ar...@tunes.org>
Branch: stm-thread-2
Changeset: r61408:bdf4b499e39b
Date: 2013-02-18 14:10 +0100
http://bitbucket.org/pypy/pypy/changeset/bdf4b499e39b/

Log:    Flush the ThreadLocalReferences whenever we are collecting.

diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py
--- a/rpython/rlib/rstm.py
+++ b/rpython/rlib/rstm.py
@@ -143,6 +143,7 @@
     @staticmethod
     def flush_all_in_this_thread():
         if we_are_translated():
+            # NB. this line is repeated in stmtls.py
             llop.stm_threadlocalref_flush(lltype.Void)
         else:
             for tlref in ThreadLocalReference._ALL.keys():
diff --git a/rpython/rtyper/memory/gc/stmtls.py 
b/rpython/rtyper/memory/gc/stmtls.py
--- a/rpython/rtyper/memory/gc/stmtls.py
+++ b/rpython/rtyper/memory/gc/stmtls.py
@@ -179,6 +179,10 @@
         #
         debug_start("gc-local")
         #
+        # First clear all thread-local caches, because they might
+        # contain pointers to objects that are about to move.
+        llop.stm_threadlocalref_flush(lltype.Void)
+        #
         if end_of_transaction:
             self.detect_flag_combination = GCFLAG_LOCAL_COPY | GCFLAG_VISITED
         else:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to