Author: Remi Meier <[email protected]>
Branch: implement-id
Changeset: r225:08871aa2ccfe
Date: 2013-06-21 14:11 +0200
http://bitbucket.org/pypy/stmgc/changeset/08871aa2ccfe/
Log: mark some paths with assert(0) because they don't seem to be reached
in demo_random.c
diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -449,7 +449,11 @@
B->h_tid |= GCFLAG_BACKUP_COPY;
B->h_tid &= ~GCFLAG_HAS_ID;
if (!(P->h_original) && (P->h_tid & GCFLAG_OLD)) {
- B->h_original = (revision_t)P;
+ /* if P is old, it must be the original
+ if P is young, it will create a shadow original later
+ or it's getting decided when backup gets stolen.
+ */
+ B->h_original = (revision_t)P;
}
P->h_tid |= GCFLAG_PRIVATE_FROM_PROTECTED;
@@ -479,6 +483,8 @@
return an old one if the nursery is full at this moment. */
gcptr L = stmgc_duplicate(R);
if (!(L->h_original)) {
+ /* if we don't have an original object yet,
+ it must be the old public R */
assert(R->h_tid & GCFLAG_OLD); // if not, force stm_id??
L->h_original = (revision_t)R;
}
@@ -1161,7 +1167,6 @@
B->h_tid |= GCFLAG_PUBLIC;
B->h_tid &= ~GCFLAG_BACKUP_COPY;
if (!(P->h_tid & GCFLAG_OLD)) P->h_tid |= GCFLAG_NURSERY_MOVED;
- fprintf(stderr, "%p made outdated, %p is current\n", P, B);
}
else
{
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -100,12 +100,15 @@
struct tx_descriptor *d = thread_descriptor;
revision_t result;
+ if (p->h_original) { /* fast path */
+ return p->h_original;
+ }
+
spinlock_acquire(d->public_descriptor->collection_lock, 'I');
- if (p->h_original) {
+ if (p->h_original) { /* maybe now? */
spinlock_release(d->public_descriptor->collection_lock);
return p->h_original;
}
-
/* old objects must have an h_original OR be
the original itself.
if some thread stole p when it was still young,
diff --git a/c4/steal.c b/c4/steal.c
--- a/c4/steal.c
+++ b/c4/steal.c
@@ -84,9 +84,11 @@
stub->h_revision = ((revision_t)obj) | 2;
if (obj->h_original) {
stub->h_original = obj->h_original;
+ assert(0);
}
else if (obj->h_tid & GCFLAG_OLD) {
stub->h_original = (revision_t)obj;
+ assert(0);
}
else {
obj->h_original = (revision_t)stub;
@@ -122,17 +124,21 @@
gcptr B = (gcptr)L->h_revision; /* the backup copy */
if (L->h_original) {
- /* may have HAS_ID */
+ /* L has an original, may be GCFLAG_HAS_ID */
B->h_original = L->h_original;
}
else if (L->h_tid & GCFLAG_OLD) {
+ /* If old, it must be the original */
assert(!(L->h_tid & GCFLAG_HAS_ID));
/* original must be L */
B->h_original = (revision_t)L;
+ assert(0);
}
else {
- /* we can make the backup the "original" */
+ /* we can make the backup the "original"
+ since L hasn't decided yet */
L->h_original = (revision_t)B;
+ assert(0);
}
/* B is now a backup copy, i.e. a protected object, and we own
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit