Author: Armin Rigo <ar...@tunes.org>
Branch: copy-over-original2
Changeset: r430:5c385b2b629a
Date: 2013-07-24 16:49 +0200
http://bitbucket.org/pypy/stmgc/changeset/5c385b2b629a/

Log:    Tweak the code for the case of a stub in h_original (tested by run
        #931 of test_more_multi_thread)

diff --git a/c4/gcpage.c b/c4/gcpage.c
--- a/c4/gcpage.c
+++ b/c4/gcpage.c
@@ -264,7 +264,10 @@
                                    where backup is stolen and its h-original
                                    points to it. */
 
-        assert(stmgc_size(id_copy) == stmgc_size(obj));
+        /* id_copy may be a stub, but in this case, as the original, it
+           should have been allocated with a big enough chunk of memory */
+        assert((id_copy->h_tid & GCFLAG_STUB) ||
+               stmgc_size(id_copy) == stmgc_size(obj));
         /* prehash may be specific hash value for prebuilts, or 0 */
         revision_t prehash = id_copy->h_original;
         assert(IMPLIES(prehash, id_copy->h_tid & GCFLAG_PREBUILT_ORIGINAL));
@@ -277,7 +280,8 @@
                     | GCFLAG_PUBLIC | GCFLAG_HAS_ID
                     | GCFLAG_PRIVATE_FROM_PROTECTED)));
         id_copy->h_original = prehash;
-        id_copy->h_tid = old_tid & ~GCFLAG_VISITED; /* will be visited next */
+        id_copy->h_tid = old_tid & ~(GCFLAG_VISITED |/* will be visited next */
+                                     GCFLAG_STUB);   /* no longer a stub */
 
         dprintf(("copy %p over %p\n", obj, id_copy));
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to