Author: Remi Meier <[email protected]>
Branch: 
Changeset: r1210:ae21b6a2a892
Date: 2014-05-14 18:02 +0200
http://bitbucket.org/pypy/stmgc/changeset/ae21b6a2a892/

Log:    fix annoying little crasher where a collection occurs while we wait
        to become inevitable. this caused the marker_inev fetched before
        that not to be traced, but we may still read it afterwards.

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -209,9 +209,7 @@
     STM_PSEGMENT->start_time = tl->_timing_cur_start;
     STM_PSEGMENT->signalled_to_commit_soon = false;
     STM_PSEGMENT->safe_point = SP_RUNNING;
-#ifndef NDEBUG
-    STM_PSEGMENT->marker_inev[1] = 99999999999999999L;
-#endif
+    STM_PSEGMENT->marker_inev[1] = 0;
     if (jmpbuf == NULL)
         marker_fetch_inev();
     STM_PSEGMENT->transaction_state = (jmpbuf != NULL ? TS_REGULAR
@@ -481,6 +479,9 @@
     STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
     STM_PSEGMENT->transaction_state = TS_NONE;
 
+    /* marker_inev is not needed anymore */
+    STM_PSEGMENT->marker_inev[1] = 0;
+
     /* reset these lists to NULL for the next transaction */
     LIST_FREE(STM_PSEGMENT->objects_pointing_to_nursery);
     LIST_FREE(STM_PSEGMENT->large_overflow_objects);
diff --git a/c7/stm/gcpage.c b/c7/stm/gcpage.c
--- a/c7/stm/gcpage.c
+++ b/c7/stm/gcpage.c
@@ -431,7 +431,7 @@
         for (i = list_count(lst); i > 0; i -= 2) {
             mark_visit_object((object_t *)list_item(lst, i - 1), base);
         }
-        if (get_priv_segment(j)->transaction_state == TS_INEVITABLE) {
+        if (get_priv_segment(j)->marker_inev[1]) {
             uintptr_t marker_inev_obj = get_priv_segment(j)->marker_inev[1];
             mark_visit_object((object_t *)marker_inev_obj, base);
         }
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -218,9 +218,9 @@
                 acquire_privatization_lock();
                 synchronize_object_now(obj);
                 release_privatization_lock();
+            } else {
+                LIST_APPEND(STM_PSEGMENT->large_overflow_objects, obj);
             }
-            else
-                LIST_APPEND(STM_PSEGMENT->large_overflow_objects, obj);
         }
 
         /* the list could have moved while appending */
@@ -244,7 +244,7 @@
     for (i = num_old + 1; i < total; i += 2) {
         minor_trace_if_young((object_t **)list_ptr_to_item(mlst, i));
     }
-    if (STM_PSEGMENT->transaction_state == TS_INEVITABLE) {
+    if (STM_PSEGMENT->marker_inev[1]) {
         uintptr_t *pmarker_inev_obj = (uintptr_t *)
             REAL_ADDRESS(STM_SEGMENT->segment_base,
                          &STM_PSEGMENT->marker_inev[1]);
@@ -341,8 +341,9 @@
         collect_modified_old_objects();
         num_old = 0;
     }
-    else
+    else {
         num_old = STM_PSEGMENT->modified_old_objects_markers_num_old;
+    }
 
     collect_roots_from_markers(num_old);
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to