Author: Remi Meier <remi.me...@inf.ethz.ch>
Branch: 
Changeset: r1233:e69d7d6c2ed9
Date: 2014-05-22 16:33 +0200
http://bitbucket.org/pypy/stmgc/changeset/e69d7d6c2ed9/

Log:    fix small bug causing test_random to fail sometimes

diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -280,6 +280,9 @@
 
         TREE_LOOP_FORWARD(*pseg->young_outside_nursery, item) {
             assert(!_is_in_nursery((object_t *)item->addr));
+            /* mark slot as unread */
+            ((stm_read_marker_t *)(item->addr >> 4))->rm = 0;
+
             _stm_large_free(stm_object_pages + item->addr);
         } TREE_LOOP_END;
 
diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -324,7 +324,7 @@
 assert HDR == 8
 GCFLAG_WRITE_BARRIER = lib._STM_GCFLAG_WRITE_BARRIER
 NB_SEGMENTS = lib.STM_NB_SEGMENTS
-
+FAST_ALLOC = lib._STM_FAST_ALLOC
 
 class Conflict(Exception):
     pass
diff --git a/c7/test/test_nursery.py b/c7/test/test_nursery.py
--- a/c7/test/test_nursery.py
+++ b/c7/test/test_nursery.py
@@ -236,3 +236,14 @@
         # the 'p1' reference is invalid now, don't try to read it.
         # we check that it's invalid because _stm_total_allocated()
         # only records one of the two objects.
+
+    def test_clear_read_marker_for_external_young(self):
+        self.start_transaction()
+        big = stm_allocate(FAST_ALLOC + 1000) # young outside nursery
+        stm_read(big)
+        assert stm_was_read(big)
+        stm_minor_collect() # free young outside
+        assert not stm_was_read(big)
+        # if the read marker is not cleared, we get false conflicts
+        # with later transactions using the same large-malloced slot
+        # as our outside-nursery-obj
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to