[pypy-commit] stmgc default: Kill this attempted test. I now belive that mark_private_from_protected()

arigo noreply at buildbot.pypy.org
Sat Jul 20 21:14:59 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r428:0168e8f4f970
Date: 2013-07-20 19:33 +0200
http://bitbucket.org/pypy/stmgc/changeset/0168e8f4f970/

Log:	Kill this attempted test. I now belive that
	mark_private_from_protected() would always result in the young
	private_from_protected objects having the GCFLAG_WRITE_BARRIER
	eventually added.

diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -225,8 +225,17 @@
         assert(items[i]->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED);
         assert(IS_POINTER(items[i]->h_revision));
 
+        /* if items[i] is young, move it, update the pointer, and
+           schedule the object for later consideration by
+           visit_all_outside_objects() (which will for example ensure
+           that the WRITE_BARRIER flag is added to it).
+        */
         visit_if_young(&items[i]);
 
+        /* the backup copy is always allocated outside the nursery,
+           but we have to trace it as well, as it may contain its own
+           young pointers.
+        */
         stmgc_trace((gcptr)items[i]->h_revision, &visit_if_young);
     }
 
diff --git a/c4/test/test_nursery.py b/c4/test/test_nursery.py
--- a/c4/test/test_nursery.py
+++ b/c4/test/test_nursery.py
@@ -200,42 +200,6 @@
     check_not_free(p2)
     assert classify(p2) == "private"
 
-def test_old_private_from_protected_to_young_private_2():
-    py.test.skip("not valid")
-    p0 = nalloc_refs(1)
-    lib.stm_commit_transaction()
-    lib.stm_begin_inevitable_transaction()
-    lib.setptr(p0, 0, ffi.NULL)
-    assert classify(p0) == "private_from_protected"
-    assert lib.in_nursery(p0)      # a young private_from_protected
-    #
-    lib.stm_push_root(p0)
-    minor_collect()
-    p0 = lib.stm_pop_root()
-    assert classify(p0) == "private_from_protected"
-    assert not lib.in_nursery(p0)  # becomes an old private_from_protected
-    #
-    # Because it's a private_from_protected, its h_revision is a pointer
-    # to the backup copy, and not stm_private_rev_num.  It means that the
-    # write barrier will always enter its slow path, even though the
-    # GCFLAG_WRITE_BARRIER is not set.
-    assert p0.h_revision != lib.get_private_rev_num()
-    assert not (p0.h_tid & GCFLAG_WRITE_BARRIER)
-    #
-    p1 = nalloc(HDR)
-    lib.setptr(p0, 0, p1)          # should trigger the write barrier again
-    assert classify(p0) == "private_from_protected"
-    lib.stm_push_root(p0)
-    minor_collect()
-    p0b = lib.stm_pop_root()
-    assert p0b == p0
-    check_nursery_free(p1)
-    assert classify(p0) == "private_from_protected"
-    p2 = lib.getptr(p0, 0)
-    assert not lib.in_nursery(p2)
-    check_not_free(p2)
-    assert classify(p2) == "private"
-
 def test_old_private_from_protected_to_young_private_3():
     p0 = palloc_refs(1)
     pw = lib.stm_write_barrier(p0)


More information about the pypy-commit mailing list