Commits

Armin Rigo committed da60079

Apply a fix already documented in stmintf and applied to pypy.

  • Participants
  • Parent commits 9df339c

Comments (0)

Files changed (1)

File hack/stm/c2/et.c

         struct tx_descriptor *d,
         gcptr G, gcptr R, gcptr R_Container, size_t offset)
 {
-  if (R != G && (--d->readonly_updates < 0 || 1))
+  if (R != G && --d->readonly_updates < 0)
     {
+      volatile revision_t *vp;
       d->readonly_updates = 148;   /* XXX tweak */
-      // compress the chain
-      while ((gcptr)G->h_revision != R)
-        {
-          gcptr G_next = (gcptr)G->h_revision;
-          G->h_revision = (revision_t)R;
-          G = G_next;
-        }
+      // compress the chain one step (cannot compress the whole chain!)
+      // avoid emitting a pointless "write", too.
+      vp = (volatile revision_t *)&G->h_revision;
+      if (*vp != (revision_t)R)
+        *vp = (revision_t)R;
       // update the original field
       if (R_Container != NULL)
         {