Commits

Armin Rigo committed b46ea71

Add a few asserts.

Comments (0)

Files changed (1)

hack/stm/python/c2.py

 
     def Localize(self, R):
         if R in self.global_to_local:
-            return self.global_to_local[R]
+            L = self.global_to_local[R]
+            assert self.h_revision(L) is R
+            return L
         L = Object()
         print 'cpu %d: localize %s -> %s' % (self._cpuindex, R, L)
         self.store((L, 'h_tid'), GCFLAG_NOT_WRITTEN | GCFLAG_LOCAL_COPY)
 
     def ReadGlobalToLocal(self, R, R_Container=None, FieldName=None):
         L = self.global_to_local[R]
+        assert self.h_revision(L) is R
         if R_Container is not None and not self.h_global(R_Container):
             # fix the original field in-place, if R_Container is local
             L_Container = R_Container
     def FindRootsForLocalCollect(self):
         self.gcroots = []
         for R, L in self.global_to_local.items():
+            assert self.h_revision(L) is R
             if not self.h_written(L):
                 self.add_flags(L, GCFLAG_GLOBAL | GCFLAG_POSSIBLY_OUTDATED)
-                assert self.h_revision(L) is R
                 continue
             self.gcroots.append([R, L, 0])