[pypy-commit] stmgc default: complete fix for last commit

Raemi noreply at buildbot.pypy.org
Thu May 22 16:58:57 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: 
Changeset: r1235:6c47b2117314
Date: 2014-05-22 16:53 +0200
http://bitbucket.org/pypy/stmgc/changeset/6c47b2117314/

Log:	complete fix for last commit

diff --git a/c7/stm/gcpage.c b/c7/stm/gcpage.c
--- a/c7/stm/gcpage.c
+++ b/c7/stm/gcpage.c
@@ -482,7 +482,22 @@
 static inline bool largemalloc_keep_object_at(char *data)
 {
     /* this is called by _stm_largemalloc_sweep() */
-    return mark_visited_test_and_clear((object_t *)(data - stm_object_pages));
+    object_t *obj = (object_t *)(data - stm_object_pages);
+    if (!mark_visited_test_and_clear(obj)) {
+#ifndef NDEBUG
+        /* This is actually needed in order to avoid random write-read
+           conflicts with objects read and freed long in the past. Still,
+           it is probably rare enough so that we don't need this additional
+           overhead. (test_random hits it sometimes) */
+        long i;
+        for (i = 1; i <= NB_SEGMENTS; i++) {
+            ((struct stm_read_marker_s *)
+             (get_segment_base(i) + (((uintptr_t)obj) >> 4)))->rm = 0;
+        }
+#endif
+        return false;
+    }
+    return true;
 }
 
 static void sweep_large_objects(void)


More information about the pypy-commit mailing list