Author: Armin Rigo <[email protected]>
Branch: copy-over-original2
Changeset: r440:0c2bd2af9b0f
Date: 2013-07-25 18:11 +0200
http://bitbucket.org/pypy/stmgc/changeset/0c2bd2af9b0f/
Log: in-progress
diff --git a/c4/gcpage.c b/c4/gcpage.c
--- a/c4/gcpage.c
+++ b/c4/gcpage.c
@@ -237,8 +237,13 @@
obj->h_tid |= GCFLAG_MOVED;
/* copy the object's content */
- dprintf(("copy %p over %p\n", obj, id_copy));
- memcpy(id_copy + 1, obj + 1, stmgc_size(obj) - sizeof(struct
stm_object_s));
+ size_t objsize;
+ if (obj->h_tid & GCFLAG_STUB)
+ objsize = sizeof(struct stm_stub_s);
+ else
+ objsize = stmgc_size(obj);
+ dprintf(("copy %p over %p (%ld bytes)\n", obj, id_copy, objsize));
+ memcpy(id_copy + 1, obj + 1, objsize - sizeof(struct stm_object_s));
/* copy the object's h_revision number */
id_copy->h_revision = obj->h_revision;
@@ -346,7 +351,8 @@
/* return this original */
original->h_tid |= GCFLAG_VISITED;
- gcptrlist_insert(&objects_to_trace, original);
+ if (!(original->h_tid & GCFLAG_STUB))
+ gcptrlist_insert(&objects_to_trace, original);
return original;
}
diff --git a/c4/test/test_gcpage.py b/c4/test/test_gcpage.py
--- a/c4/test/test_gcpage.py
+++ b/c4/test/test_gcpage.py
@@ -303,19 +303,14 @@
major_collect()
check_prebuilt(p1)
check_free_old(p2)
- check_not_free(p3) # XXX replace with p1
+ check_free_old(p3)
-def test_prebuilt_version_2_copy_over_prebuilt():
+def test_prebuilt_with_hash():
p1 = lib.pseudoprebuilt_with_hash(HDR, 42 + HDR, 99)
p2 = oalloc(HDR); make_public(p2)
p3 = oalloc(HDR); make_public(p3)
delegate(p1, p2)
- delegate_original(p1, p2)
delegate(p2, p3)
- delegate_original(p1, p3)
- # added by delegate, remove, otherwise
- # major_collect will not copy over prebuilt p1:
- p1.h_tid &= ~GCFLAG_PUBLIC_TO_PRIVATE
major_collect()
check_prebuilt(p1)
assert lib.stm_hash(p1) == 99
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit