Author: Armin Rigo <[email protected]>
Branch:
Changeset: r113:b9568f14bdd9
Date: 2013-06-13 10:36 +0200
http://bitbucket.org/pypy/stmgc/changeset/b9568f14bdd9/
Log: Fix "stealing again the same object"
diff --git a/c4/steal.c b/c4/steal.c
--- a/c4/steal.c
+++ b/c4/steal.c
@@ -109,6 +109,10 @@
if (B->h_tid & GCFLAG_PUBLIC_TO_PRIVATE) {
/* already stolen */
+ assert(B->h_tid & GCFLAG_PUBLIC);
+ fprintf(stderr, "already stolen: %p -> %p <-> %p\n", P, L, B);
+ L = B;
+ goto already_stolen;
}
else {
B->h_tid |= GCFLAG_PUBLIC_TO_PRIVATE;
@@ -116,18 +120,26 @@
don't want to walk over the feet of the foreign thread
*/
gcptrlist_insert2(&foreign_pd->stolen_objects, B, L);
+ fprintf(stderr, "stolen: %p -> %p <-> %p\n", P, L, B);
+ L = B;
}
- fprintf(stderr, "stolen: %p -> %p - - -> %p\n", P, B, L);
- L = B;
}
else {
- fprintf(stderr, "stolen: %p -> %p\n", P, L);
+ if (L->h_tid & GCFLAG_PUBLIC) {
+ /* already stolen */
+ fprintf(stderr, "already stolen: %p -> %p\n", P, L);
+ goto already_stolen;
+ }
+ else {
+ fprintf(stderr, "stolen: %p -> %p\n", P, L);
+ }
}
/* Here L is a protected (or backup) copy, and we own the foreign
thread's collection_lock, so we can read/write the flags. Change
it from protected to public.
*/
+ assert(!(L->h_tid & GCFLAG_PUBLIC));
L->h_tid |= GCFLAG_PUBLIC;
/* Note that all protected or backup copies have a h_revision that
@@ -163,6 +175,7 @@
*/
smp_wmb();
+ already_stolen:
/* update the original P->h_revision to point directly to L */
P->h_revision = (revision_t)L;
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit