[pypy-commit] stmgc c7-refactor: Failing test

arigo noreply at buildbot.pypy.org
Sun Feb 23 16:32:47 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r816:8cbb49ebda1c
Date: 2014-02-23 16:32 +0100
http://bitbucket.org/pypy/stmgc/changeset/8cbb49ebda1c/

Log:	Failing test

diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -413,7 +413,7 @@
     /* We just waited here, either from mutex_lock() or from cond_wait(),
        so we should check again if another thread did the minor
        collection itself */
-    if (nursery_ctl.used + request_size <= NURSERY_SIZE)
+    if (request_size <= NURSERY_SIZE - nursery_ctl.used)
         goto exit;
 
     if (!try_wait_for_other_safe_points(SP_SAFE_POINT_CAN_COLLECT))
@@ -428,6 +428,12 @@
     mutex_unlock();
 }
 
+void stm_collect(long level)
+{
+    assert(level == 0);
+    stm_minor_collection(-1);
+}
+
 
 /************************************************************/
 
diff --git a/c7/stmgc.h b/c7/stmgc.h
--- a/c7/stmgc.h
+++ b/c7/stmgc.h
@@ -254,6 +254,9 @@
         _stm_collectable_safe_point();
 }
 
+/* Forces a collection. */
+void stm_collect(long level);
+
 
 /* ==================== END ==================== */
 
diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -79,6 +79,8 @@
 
 object_t *_stm_enum_old_objects_pointing_to_young(void);
 object_t *_stm_enum_modified_objects(void);
+
+void stm_collect(long level);
 """)
 
 
@@ -348,7 +350,7 @@
         raise Conflict()
 
 def stm_minor_collect():
-    lib._stm_minor_collect()
+    lib.stm_collect(0)
 
 def stm_get_page_flag(pagenum):
     return lib.stm_get_page_flag(pagenum)
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
@@ -129,11 +129,16 @@
         assert young
 
     def test_larger_than_section(self):
-        obj_size = lib.NURSERY_SECTION + 16
+        obj_size = NURSERY_SECTION_SIZE + 16
 
         self.start_transaction()
-        new = stm_allocate(obj_size)
-        assert not is_in_nursery(new)
+        seen = set()
+        for i in range(10):
+            stm_minor_collect()
+            new = stm_allocate(obj_size)
+            assert not is_in_nursery(new)
+            seen.add(new)
+        assert len(seen) < 5     # addresses are reused
 
     def test_reset_partial_alloc_pages(self):
         self.start_transaction()


More information about the pypy-commit mailing list