Commits

Armin Rigo committed ecb25dc

Fix the test of 1bb21a8ad460.

  • Participants
  • Parent commits 91ef9bb
  • Branches stm-gc

Comments (0)

Files changed (1)

pypy/rpython/memory/gc/stmtls.py

         """
         #
         debug_start("gc-local")
+        self.ending_transaction = end_of_transaction
         #
         # Move away the previous sharedarea_tls and start a new one.
         from pypy.rpython.memory.gc.stmshared import StmGCThreadLocalAllocator
         if not self.is_in_nursery(obj):
             # we ignore both GLOBAL objects and objects which have already
             # been VISITED
-            if hdr.tid & (GCFLAG_GLOBAL|GCFLAG_VISITED) == 0:
+            if hdr.tid & (GCFLAG_GLOBAL | GCFLAG_VISITED) == 0:
                 ll_assert(hdr.tid & GCFLAG_WAS_COPIED == 0,
                           "local GCFLAG_WAS_COPIED without GCFLAG_VISITED")
                 hdr.tid |= GCFLAG_VISITED
                 self.pending.append(obj)
+            else:
+                # xxx optimize this case: at the end of transactions,
+                # replace references to the local copy with references
+                # to the global copy
+                if (self.ending_transaction > 0 and
+                    hdr.tid & GCFLAG_GLOBAL == 0 and
+                    hdr.tid & GCFLAG_WAS_COPIED != 0):
+                    root.address[0] = hdr.version
             return
         #
         # If 'obj' was already forwarded, change it to its forwarding address.