Author: Remi Meier <remi.me...@gmail.com>
Branch: 
Changeset: r553:281794862f21
Date: 2013-11-21 16:00 +0100
http://bitbucket.org/pypy/stmgc/changeset/281794862f21/

Log:    fix failing case from last commit by purging objects from aborted
        transactions from old_objects_to_trace

diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -738,9 +738,11 @@
       W = LocalizePublic(d, R);
       assert(is_private(W));
 
-      if (W->h_tid & GCFLAG_OLD)
+      if (W->h_tid & GCFLAG_OLD) {
+        /* XXX: probably unnecessary as it is done in allocate_next_section
+           already */
         gcptrlist_insert(&d->old_objects_to_trace, W);
-      else
+      } else
         gcptrlist_insert(&d->public_with_young_copy, R);
     }
   else
@@ -900,6 +902,21 @@
   smp_spinloop();
 }
 
+static void purge_private_objs_from_old_objects_to_trace()
+{
+  struct tx_descriptor *d = thread_descriptor;
+  int i, size = d->old_objects_to_trace.size;
+  gcptr *items = d->old_objects_to_trace.items;
+
+  for(i = 0; i < size; i++) {
+    if (items[i] && items[i]->h_revision == stm_private_rev_num) {
+      /* private objects from the same aborting transaction */
+      items[i] = NULL;
+      dprintf(("purge old private object %p\n", items[i]));
+    }
+  }
+}
+
 void stm_abort_and_retry(void)
 {
     AbortTransaction(ABRT_MANUAL);
@@ -990,6 +1007,12 @@
   stm_thread_local_obj = d->old_thread_local_obj;
   d->old_thread_local_obj = NULL;
 
+  /* remove old private objects from old_objects_to_trace
+     because they never have to be traced (also because
+     weakrefs are kept alive even when their target is not
+     and stm_move_young_weakrefs doesn't handle that). */
+  purge_private_objs_from_old_objects_to_trace();
+
   // notifies the CPU that we're potentially in a spin loop
   SpinLoop(SPLP_ABORT);
 
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -408,7 +408,8 @@
 {
     while (gcptrlist_size(&d->old_objects_to_trace) > 0) {
         gcptr obj = gcptrlist_pop(&d->old_objects_to_trace);
-
+        if (!obj)
+            continue;
         assert(obj->h_tid & GCFLAG_OLD);
         assert(!(obj->h_tid & GCFLAG_WRITE_BARRIER));
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to