[pypy-commit] stmgc default: another bug with h_original :(
Raemi
noreply at buildbot.pypy.org
Mon Aug 19 11:28:51 CEST 2013
Author: Remi Meier <remi.meier at gmail.com>
Branch:
Changeset: r484:e02ee68b20c4
Date: 2013-08-19 11:28 +0200
http://bitbucket.org/pypy/stmgc/changeset/e02ee68b20c4/
Log: another bug with h_original :(
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -177,10 +177,21 @@
fresh_old_copy = id_obj;
fresh_old_copy->h_original = 0;
obj->h_tid &= ~GCFLAG_HAS_ID;
+
+ /* priv_from_prot's backup->h_originals already point
+ to id_obj */
}
else {
/* make a copy of it outside */
fresh_old_copy = create_old_object_copy(obj);
+
+ if (obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED
+ && !(obj->h_original)) {
+ /* the object's backup copy still has
+ a h_original that is NULL*/
+ gcptr B = (gcptr)obj->h_revision;
+ B->h_original = (revision_t)fresh_old_copy;
+ }
}
obj->h_tid |= GCFLAG_MOVED;
diff --git a/c4/test/test_extra.py b/c4/test/test_extra.py
--- a/c4/test/test_extra.py
+++ b/c4/test/test_extra.py
@@ -157,7 +157,7 @@
0, 0,
0, 0]
-def test_bug():
+def test_clear_original_on_id_copy():
p1 = nalloc(HDR)
pid = lib.stm_id(p1)
lib.stm_push_root(p1)
@@ -167,7 +167,7 @@
assert p1o == ffi.cast("gcptr", pid)
assert follow_original(p1o) == ffi.NULL
-def test_bug2():
+def test_clear_original_on_priv_from_prot_abort():
p = oalloc(HDR+WORD)
def cb(c):
@@ -179,4 +179,25 @@
p = lib.stm_pop_root()
assert follow_original(p) == ffi.NULL
+def test_set_backups_original_on_move_to_id_copy():
+ p1 = nalloc(HDR+WORD)
+ lib.stm_commit_transaction()
+ lib.stm_begin_inevitable_transaction()
+ assert classify(p1) == 'protected'
+
+ pw = lib.stm_write_barrier(p1)
+ assert classify(pw) == 'private_from_protected'
+ assert pw == p1
+ lib.stm_push_root(pw)
+ # make pw old
+ minor_collect()
+ p1o = lib.stm_pop_root()
+
+ # Backup has updated h_original:
+ assert classify(p1o) == 'private_from_protected'
+ B = follow_revision(p1o)
+ assert follow_original(B) == p1o
+
+
+
More information about the pypy-commit
mailing list