[pypy-commit] stmgc weakref: more debug output
Raemi
noreply at buildbot.pypy.org
Fri Jul 19 12:06:53 CEST 2013
Author: Remi Meier <remi.meier at gmail.com>
Branch: weakref
Changeset: r418:983bb16c726a
Date: 2013-07-19 11:46 +0200
http://bitbucket.org/pypy/stmgc/changeset/983bb16c726a/
Log: more debug output
diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -16,13 +16,14 @@
i = 0;
cur = tmp_buf;
+ cur += sprintf(cur, "%p:", obj);
while (flags[i]) {
if (obj->h_tid & (STM_FIRST_GCFLAG << i)) {
cur += sprintf(cur, "%s|", flags[i]);
}
i++;
}
- cur += sprintf(cur, "tid=%ld\n", stm_get_tid(obj));
+ cur += sprintf(cur, "tid=%ld", stm_get_tid(obj));
return tmp_buf;
}
#endif
diff --git a/c4/steal.c b/c4/steal.c
--- a/c4/steal.c
+++ b/c4/steal.c
@@ -27,10 +27,11 @@
if (obj->h_tid & GCFLAG_IMMUTABLE) {
assert(!(obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED));
if (obj->h_tid & GCFLAG_PUBLIC) {
- /* young public */
+ /* young public, replace with stolen old copy */
assert(obj->h_tid & GCFLAG_NURSERY_MOVED);
assert(IS_POINTER(obj->h_revision));
stub = (gcptr)obj->h_revision;
+ assert(!IS_POINTER(stub->h_revision)); /* not outdated */
goto done;
}
@@ -52,10 +53,10 @@
if (!(obj->h_original))
obj->h_original = (revision_t)O;
}
+ obj->h_tid |= (GCFLAG_NURSERY_MOVED | GCFLAG_PUBLIC);
obj->h_revision = (revision_t)O;
O->h_tid |= GCFLAG_PUBLIC;
- obj->h_tid |= (GCFLAG_NURSERY_MOVED | GCFLAG_PUBLIC);
/* here it is fine if it stays in read caches because
the object is immutable anyway and there are no
write_barriers allowed. */
diff --git a/c4/weakref.c b/c4/weakref.c
--- a/c4/weakref.c
+++ b/c4/weakref.c
@@ -41,9 +41,13 @@
if (is_in_nursery(d, pointing_to)) {
if (pointing_to->h_tid & GCFLAG_NURSERY_MOVED) {
+ dprintf(("weakref ptr moved %p->%p\n",
+ WEAKREF_PTR(weakref, size),
+ (gcptr)pointing_to->h_revision));
WEAKREF_PTR(weakref, size) = (gcptr)pointing_to->h_revision;
}
else {
+ dprintf(("weakref lost ptr %p\n", WEAKREF_PTR(weakref, size)));
WEAKREF_PTR(weakref, size) = NULL;
continue; /* no need to remember this weakref any longer */
}
@@ -143,6 +147,10 @@
assert(pointing_to != NULL);
if (is_partially_visited(pointing_to)) {
pointing_to = stmgcpage_visit(pointing_to);
+ dprintf(("mweakref ptr moved %p->%p\n",
+ WEAKREF_PTR(weakref, size),
+ pointing_to));
+
assert(pointing_to->h_tid & GCFLAG_VISITED);
WEAKREF_PTR(weakref, size) = pointing_to;
}
@@ -169,6 +177,7 @@
if (pointing_to->h_tid & GCFLAG_VISITED) {
continue; /* the target stays alive, the weakref remains */
}
+ dprintf(("mweakref lost ptr %p\n", WEAKREF_PTR(weakref, size)));
WEAKREF_PTR(weakref, size) = NULL; /* the target dies */
}
/* remove this weakref from the list */
More information about the pypy-commit
mailing list