Author: Armin Rigo <[email protected]>
Branch:
Changeset: r131:69b1046ea32d
Date: 2013-06-14 20:27 +0200
http://bitbucket.org/pypy/stmgc/changeset/69b1046ea32d/
Log: Test and bug fix
diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -476,8 +476,8 @@
if (is_private(R))
{
- record_write_barrier(P);
- return P;
+ record_write_barrier(R);
+ return R;
}
struct tx_descriptor *d = thread_descriptor;
@@ -498,6 +498,7 @@
assert(R->h_tid & GCFLAG_OLD);
gcptrlist_insert(&d->public_with_young_copy, R);
W = LocalizePublic(d, R);
+ assert(is_private(W));
}
else
{
@@ -505,6 +506,7 @@
an old object that still has GCFLAG_WRITE_BARRIER, then we must
also record it in the list 'old_objects_to_trace'. */
W = LocalizeProtected(d, R);
+ assert(is_private(W));
record_write_barrier(W);
}
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
@@ -216,3 +216,19 @@
assert p2 == p1
assert not lib.in_nursery(p2)
assert classify(p2) == "private_from_protected"
+
+def test_prebuilt_version():
+ p1 = lib.pseudoprebuilt(HDR, 42 + HDR)
+ p2 = lib.stm_write_barrier(p1)
+ assert p2 != p1
+ check_prebuilt(p1)
+ check_not_free(p2)
+ minor_collect()
+ check_prebuilt(p1)
+ check_nursery_free(p2)
+ p2 = lib.stm_read_barrier(p1)
+ assert classify(p2) == "private"
+ p3 = lib.stm_write_barrier(p1)
+ assert classify(p3) == "private"
+ assert p3 == p2 != p1
+ assert not lib.in_nursery(p2)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit