Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r343:69be3c7a1f51 Date: 2013-07-03 16:13 +0200 http://bitbucket.org/pypy/stmgc/changeset/69be3c7a1f51/
Log: Fix a hard bug. diff --git a/c4/nursery.c b/c4/nursery.c --- a/c4/nursery.c +++ b/c4/nursery.c @@ -318,6 +318,7 @@ *root = fresh_old_copy; /* add 'fresh_old_copy' to the list of objects to trace */ + assert(!(fresh_old_copy->h_tid & GCFLAG_PUBLIC)); gcptrlist_insert(&d->old_objects_to_trace, fresh_old_copy); } } @@ -477,7 +478,18 @@ assert(obj->h_tid & GCFLAG_OLD); assert(!(obj->h_tid & GCFLAG_WRITE_BARRIER)); - obj->h_tid |= GCFLAG_WRITE_BARRIER; + + /* We add the WRITE_BARRIER flag to objects here, but warning: + we may occasionally see a PUBLIC object --- one that was + a private/protected object when it was added to + old_objects_to_trace, and has been stolen. So we have to + check and not do any change the obj->h_tid in that case. + Otherwise this conflicts with the rule that we may only + modify obj->h_tid of a public object in order to add + PUBLIC_TO_PRIVATE. + */ + if (!(obj->h_tid & GCFLAG_PUBLIC)) + obj->h_tid |= GCFLAG_WRITE_BARRIER; stmgc_trace(obj, &visit_if_young); } @@ -675,6 +687,7 @@ gcptr P = stmgcpage_malloc(allocate_size); memset(P, 0, allocate_size); P->h_tid = tid | GCFLAG_OLD; + assert(!(P->h_tid & GCFLAG_PUBLIC)); gcptrlist_insert(&d->old_objects_to_trace, P); return P; } _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit