Armin Rigo avatar Armin Rigo committed eb306fa

Update to arigo/2f5d4cc948b2.

Comments (0)

Files changed (2)

pypy/translator/stm/src_stm/et.c

 
 /************************************************************/
 
-gcptr Allocate(size_t size, int gctid)
-{
-  gcptr W = malloc(size);
-  W->h_tid = gctid;
-  W->h_revision = REV_INITIAL;
-  return W;
-}
-
 static inline void PossiblyUpdateChain(
         struct tx_descriptor *d,
         gcptr G, gcptr R, gcptr R_Container, size_t offset)
   memcpy(L, R, size);
   L->h_tid &= ~(GCFLAG_GLOBAL | GCFLAG_POSSIBLY_OUTDATED);
   assert(L->h_tid & GCFLAG_NOT_WRITTEN);
+  L->h_tid |= GCFLAG_LOCAL_COPY;
   L->h_revision = (revision_t)R;     /* back-reference to the original */
   g2l_insert(&d->global_to_local, R, L);
   return L;
   if (P->h_tid & GCFLAG_GLOBAL)
     return 0;
   P->h_tid |= GCFLAG_GLOBAL | GCFLAG_NOT_WRITTEN;
+  if ((P->h_tid & GCFLAG_LOCAL_COPY) == 0)
+    P->h_revision = 1;
   return 1;
 }
 
 
 inline static gcptr GlobalizeForComparison(struct tx_descriptor *d, gcptr P)
 {
-  if (P == NULL)
-    return NULL;
-  else if (P->h_tid & GCFLAG_GLOBAL)
-    return LatestGlobalRevision(d, P, NULL, 0);
-  else if (P->h_revision != REV_INITIAL)
-    return (gcptr)P->h_revision;    // return the original global obj
-  else
-    return P;        // local, allocated during this transaction
+  if (P != NULL && (P->h_tid & (GCFLAG_GLOBAL | GCFLAG_LOCAL_COPY)))
+    {
+      if (P->h_tid & GCFLAG_GLOBAL)
+        P = LatestGlobalRevision(d, P, NULL, 0);
+      else
+        P = (gcptr)P->h_revision;    // return the original global obj
+    }
+  return P;
 }
 
 _Bool PtrEq(gcptr P1, gcptr P2)

pypy/translator/stm/src_stm/et.h

   GCFLAG_GLOBAL            = _first_gcflag << 0,
   GCFLAG_POSSIBLY_OUTDATED = _first_gcflag << 1,
   GCFLAG_NOT_WRITTEN       = _first_gcflag << 2,
+  GCFLAG_LOCAL_COPY        = _first_gcflag << 3,
 
   GCFLAG_PREBUILT          = GCFLAG_GLOBAL|GCFLAG_NOT_WRITTEN,
   REV_INITIAL              = 1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.