Author: Remi Meier <[email protected]>
Branch:
Changeset: r423:dad61e32d0b3
Date: 2013-07-19 13:54 +0200
http://bitbucket.org/pypy/stmgc/changeset/dad61e32d0b3/
Log: understand and fix tests
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -406,7 +406,7 @@
static void teardown_minor_collect(struct tx_descriptor *d)
{
- //assert(gcptrlist_size(&d->old_objects_to_trace) == 0);
+ assert(gcptrlist_size(&d->old_objects_to_trace) == 0);
assert(gcptrlist_size(&d->public_with_young_copy) == 0);
assert(gcptrlist_size(&d->public_descriptor->stolen_objects) == 0);
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
@@ -201,6 +201,7 @@
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()
@@ -245,26 +246,27 @@
assert lib.in_nursery(pr) # a young protected
#
minor_collect()
+ # each minor collect adds WRITE_BARRIER to protected/private
+ # objects it moves out of the nursery
pr = lib.stm_read_barrier(p0)
+ assert pr.h_tid & GCFLAG_WRITE_BARRIER
pw = lib.stm_write_barrier(pr)
+ # added to old_obj_to_trace
+ assert not (pw.h_tid & GCFLAG_WRITE_BARRIER)
+
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()
+ assert pw.h_tid & GCFLAG_WRITE_BARRIER
lib.setptr(pw, 0, p1) # should trigger the write barrier again
assert classify(pr) == "private_from_protected"
minor_collect()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit