[pypy-commit] stmgc nonmovable-int-ref: merge
Raemi
noreply at buildbot.pypy.org
Mon Aug 19 08:58:55 CEST 2013
Author: Remi Meier <remi.meier at gmail.com>
Branch: nonmovable-int-ref
Changeset: r482:bd11f3c7cfe8
Date: 2013-08-15 18:29 +0200
http://bitbucket.org/pypy/stmgc/changeset/bd11f3c7cfe8/
Log: merge
diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -1337,9 +1337,13 @@
and then free B, which will not be used any more. */
size_t size = stmgc_size(B);
assert(B->h_tid & GCFLAG_BACKUP_COPY);
+ /* if h_original was 0, it must stay that way and not point
+ to itself. (B->h_original may point to P) */
+ revision_t h_original = P->h_original;
memcpy(((char *)P) + offsetof(struct stm_object_s, h_revision),
((char *)B) + offsetof(struct stm_object_s, h_revision),
size - offsetof(struct stm_object_s, h_revision));
+ P->h_original = h_original;
assert(!(P->h_tid & GCFLAG_BACKUP_COPY));
stmgcpage_free(B);
dprintf(("abort: free backup at %p\n", B));
diff --git a/c4/extra.c b/c4/extra.c
--- a/c4/extra.c
+++ b/c4/extra.c
@@ -136,6 +136,8 @@
return (revision_t)p;
}
+ assert(p->h_original != (revision_t)p);
+
dprintf(("stm_id(%p) has orig fst: %p\n",
p, (gcptr)p->h_original));
return p->h_original;
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -175,6 +175,7 @@
stm_copy_to_old_id_copy(obj, id_obj);
fresh_old_copy = id_obj;
+ fresh_old_copy->h_original = 0;
obj->h_tid &= ~GCFLAG_HAS_ID;
}
else {
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,29 @@
0, 0,
0, 0]
+def test_bug():
+ p1 = nalloc(HDR)
+ pid = lib.stm_id(p1)
+ lib.stm_push_root(p1)
+ minor_collect()
+ p1o = lib.stm_pop_root()
+ assert p1o == ffi.cast("gcptr", pid)
+ assert follow_original(p1o) == ffi.NULL
+
+def test_bug2():
+ p = oalloc(HDR+WORD)
+
+ def cb(c):
+ if c == 0:
+ pw = lib.stm_write_barrier(p)
+ abort_and_retry()
+ lib.stm_push_root(p)
+ perform_transaction(cb)
+ p = lib.stm_pop_root()
+ assert follow_original(p) == ffi.NULL
+
+
def test_allocate_public_integer_address():
p1 = palloc(HDR)
More information about the pypy-commit
mailing list