[pypy-commit] stmgc default: add another test that passes, not sure why
Raemi
noreply at buildbot.pypy.org
Fri Jul 19 12:44:35 CEST 2013
Author: Remi Meier <remi.meier at gmail.com>
Branch:
Changeset: r422:1e4740b610b6
Date: 2013-07-19 12:44 +0200
http://bitbucket.org/pypy/stmgc/changeset/1e4740b610b6/
Log: add another test that passes, not sure why
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
@@ -235,6 +235,47 @@
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)
+ lib.stm_commit_transaction()
+ lib.stm_begin_inevitable_transaction()
+ pr = lib.stm_read_barrier(p0)
+ assert classify(pr) == "protected"
+ assert lib.in_nursery(pr) # a young protected
+ #
+ minor_collect()
+ pr = lib.stm_read_barrier(p0)
+ pw = lib.stm_write_barrier(pr)
+ lib.setptr(pw, 0, ffi.NULL)
+ assert classify(pw) == "private_from_protected"
+ assert not lib.in_nursery(pw)
+ #
+ # Because it was protected young before, it has no WRITE_BARRIER
+ # flag. After transforming it to a PRIV_FROM_PROT, the following
+ # holds:
+ # 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 pw.h_revision != lib.get_private_rev_num()
+ assert not (pw.h_tid & GCFLAG_WRITE_BARRIER)
+ # #
+ lib.stm_push_root(pw)
+ minor_collect()
+ p1 = nalloc(HDR)
+ pw = lib.stm_pop_root()
+ lib.setptr(pw, 0, p1) # should trigger the write barrier again
+ assert classify(pr) == "private_from_protected"
+ minor_collect()
+ check_nursery_free(p1)
+ pr = lib.stm_read_barrier(p0)
+ assert classify(pr) == "private_from_protected"
+ p2 = lib.getptr(pr, 0)
+ assert not lib.in_nursery(p2)
+ check_not_free(p2)
+ assert classify(p2) == "private"
+
def test_new_version():
p1 = oalloc(HDR)
assert lib.stm_write_barrier(p1) == p1
More information about the pypy-commit
mailing list