Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r151:502b592672e6 Date: 2013-06-16 16:58 +0200 http://bitbucket.org/pypy/stmgc/changeset/502b592672e6/
Log: Bug fix (GCFLAG_PUBLIC -> GCFLAG_OLD, in the middle of debugging prints) diff --git a/c4/et.c b/c4/et.c --- a/c4/et.c +++ b/c4/et.c @@ -283,6 +283,23 @@ return NULL; } +static void _check_flags(gcptr P) +{ + struct tx_descriptor *d = thread_descriptor; + int is_old = (P->h_tid & GCFLAG_OLD) != 0; + int in_nurs = (d->nursery_base <= (char*)P && ((char*)P) < d->nursery_end); + if (in_nurs) + { + assert(!is_old); + fprintf(stderr, "Y "); + } + else + { + assert(is_old); + fprintf(stderr, "O "); + } +} + gcptr _stm_nonrecord_barrier(gcptr P) { /* follows the logic in stm_DirectReadBarrier() */ @@ -290,6 +307,7 @@ revision_t v; fprintf(stderr, "_stm_nonrecord_barrier: %p ", P); + _check_flags(P); restart_all: if (P->h_revision == stm_private_rev_num) @@ -313,6 +331,9 @@ while (v = P->h_revision, IS_POINTER(v)) { + if (P->h_tid & GCFLAG_NURSERY_MOVED) + fprintf(stderr, "nursery_moved "); + if (v & 2) { fprintf(stderr, "stub "); @@ -323,6 +344,7 @@ } P = (gcptr)v; + _check_flags(P); assert(P->h_tid & GCFLAG_PUBLIC); fprintf(stderr, "-> %p public ", P); } @@ -348,15 +370,18 @@ if (STUB_THREAD(P) == d->public_descriptor) { P = (gcptr)(v - 2); + _check_flags(P); fprintf(stderr, "-> %p ", P); } else { P = (gcptr)(v - 2); + /* cannot _check_flags(P): foreign! */ fprintf(stderr, "-foreign-> %p ", P); if (P->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED) { P = (gcptr)P->h_revision; /* the backup copy */ + /* cannot _check_flags(P): foreign! */ fprintf(stderr, "-backup-> %p ", P); } if (!(P->h_tid & GCFLAG_PUBLIC)) @@ -365,6 +390,7 @@ return (gcptr)-1; } } + /* cannot _check_flags(P): foreign! */ goto restart_all; } @@ -409,7 +435,7 @@ P->h_revision = (revision_t)B; gcptrlist_insert(&d->private_from_protected, P); - fprintf(stderr, "private_from_protected: insert %p\n", P); + fprintf(stderr, "private_from_protected: insert %p (backup %p)\n", P, B); return P; /* always returns its arg: the object is converted in-place */ } @@ -1006,6 +1032,7 @@ else { stm_free(B, stmcb_size(B)); + fprintf(stderr, "commit: free backup at %p\n", B); } }; gcptrlist_clear(&d->private_from_protected); @@ -1052,6 +1079,7 @@ size - offsetof(struct stm_object_s, h_revision)); assert(!(P->h_tid & GCFLAG_BACKUP_COPY)); stm_free(B, size); + fprintf(stderr, "abort: free backup at %p\n", B); } }; gcptrlist_clear(&d->private_from_protected); diff --git a/c4/nursery.c b/c4/nursery.c --- a/c4/nursery.c +++ b/c4/nursery.c @@ -17,6 +17,9 @@ memset(d->nursery_base, 0, GC_NURSERY); d->nursery_end = d->nursery_base + GC_NURSERY; d->nursery_current = d->nursery_base; + + fprintf(stderr, "minor: nursery is at [%p to %p]\n", d->nursery_base, + d->nursery_end); } void stmgc_done_nursery(void) diff --git a/c4/steal.c b/c4/steal.c --- a/c4/steal.c +++ b/c4/steal.c @@ -55,7 +55,8 @@ static void replace_ptr_to_protected_with_stub(gcptr *pobj) { gcptr stub, obj = *pobj; - if (obj == NULL || (obj->h_tid & GCFLAG_PUBLIC) != 0) + if (obj == NULL || (obj->h_tid & (GCFLAG_PUBLIC | GCFLAG_OLD)) == + (GCFLAG_PUBLIC | GCFLAG_OLD)) return; /* we use 'all_stubs', a dictionary, in order to try to avoid @@ -138,8 +139,10 @@ has GCFLAG_NURSERY_MOVED), but it is fine to do it more generally. */ v = ACCESS_ONCE(L->h_revision); - if (IS_POINTER(v)) + if (IS_POINTER(v)) { L = (gcptr)v; + fprintf(stderr, "\t---> %p\n", L); + } goto already_stolen; } @@ -151,6 +154,7 @@ L->h_revision = (revision_t)O; L->h_tid |= GCFLAG_PUBLIC | GCFLAG_NURSERY_MOVED; L = O; + fprintf(stderr, "\t---> %p\n", L); } assert(L->h_tid & GCFLAG_OLD); } _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit