Commit 4d570d2d authored by Ben Gamari's avatar Ben Gamari 🐢

Weak debugging

parent 639fe12a
......@@ -3080,6 +3080,7 @@ resurrectThreads (StgTSO *threads)
for (tso = threads; tso != END_TSO_QUEUE; tso = next) {
next = tso->global_link;
debugBelch("resurrect %p\n", tso);
gen = Bdescr((P_)tso)->gen;
tso->global_link = gen->threads;
......
......@@ -205,6 +205,7 @@ static bool resurrectUnreachableThreads (generation *gen, StgTSO **resurrected_t
for (t = gen->old_threads; t != END_TSO_QUEUE; t = next) {
next = t->global_link;
debugBelch("resurrectUnreachableThreads %p, gen=%d\n", t, gen->no);
// ThreadFinished and ThreadComplete: we have to keep
// these on the all_threads list until they
......@@ -301,6 +302,9 @@ static bool tidyWeakList(generation *gen)
continue;
}
else {
debugTrace(DEBUG_weak,
"weak pointer %p with key %p died at",
w, w->key);
last_w = &(w->link);
next_w = w->link;
continue;
......@@ -328,6 +332,8 @@ static void tidyThreadList (generation *gen)
t = tmp;
}
debugBelch("tidyThreadList(gen=%d): %p => %p\n", gen->no, t, tmp);
ASSERT(get_itbl((StgClosure *)t)->type == TSO);
next = t->global_link;
......
......@@ -861,6 +861,7 @@ void nonmovingCollect(StgWeak **dead_weaks, StgTSO **resurrected_threads)
// Mark threads resurrected during moving heap scavenging
for (StgTSO *tso = *resurrected_threads; tso != END_TSO_QUEUE; tso = tso->global_link) {
debugBelch("resurrecting from moving %p\n", tso);
markQueuePushClosure_(mark_queue, (StgClosure*)tso);
}
trace(TRACE_nonmoving_gc, "Finished marking roots for nonmoving GC");
......
......@@ -1661,6 +1661,7 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin)
}
case TSO:
debugBelch("Marked TSO %p\n", p);
mark_tso(queue, (StgTSO *) p);
break;
......@@ -2011,6 +2012,9 @@ void nonmovingTidyThreads ()
next = t->global_link;
debugBelch("nonmovingTidyThreads: %p => %s\n",
t, nonmovingIsNowAlive((StgClosure*) t) ? "live" : "dead");
// N.B. This thread is in old_threads, consequently we *know* it is in
// the snapshot and it is therefore safe to rely on the bitmap to
// determine its reachability.
......@@ -2033,6 +2037,7 @@ void nonmovingResurrectThreads (struct MarkQueue_ *queue, StgTSO **resurrected_t
StgTSO *next;
for (StgTSO *t = nonmoving_old_threads; t != END_TSO_QUEUE; t = next) {
next = t->global_link;
debugBelch("nonmoving resurrect %p\n", t);
switch (t->what_next) {
case ThreadKilled:
......
......@@ -134,9 +134,11 @@ nonmovingScavengeOne (StgClosure *q)
// moving heap which may be long gone by the time we call
// nonmovingTidyWeaks.
StgWeak *weak = (StgWeak *) p;
gct->eager_promotion = true;
evacuate(&weak->key);
gct->eager_promotion = saved_eager_promotion;
debugBelch("nonmovingScav: evac key %p (gen=%d) of weak %p\n",
weak->key, Bdescr(weak->key)->gen_no, weak);
//gct->eager_promotion = true;
//evacuate(&weak->key);
//gct->eager_promotion = saved_eager_promotion;
goto gen_obj;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment