summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-05-21 18:08:01 -0400
committerBen Gamari <ben@smart-cactus.org>2019-10-22 18:57:42 -0400
commit6efab67bfbaabf2ac6ec7f10ee83955b286f48fe (patch)
tree460744a0a01a1bf2831e96dbe54db379c7918220
parentde7f902e3eb3872bd743925a7573e4728f4fd4a5 (diff)
downloadhaskell-6efab67bfbaabf2ac6ec7f10ee83955b286f48fe.tar.gz
Weak debugging
-rw-r--r--rts/Schedule.c1
-rw-r--r--rts/sm/MarkWeak.c6
-rw-r--r--rts/sm/NonMoving.c1
-rw-r--r--rts/sm/NonMovingMark.c5
-rw-r--r--rts/sm/NonMovingScav.c8
5 files changed, 18 insertions, 3 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index fdaa51c85a..06a9c43d02 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -3074,6 +3074,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;
diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c
index 7475b5e625..3c25774b4f 100644
--- a/rts/sm/MarkWeak.c
+++ b/rts/sm/MarkWeak.c
@@ -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;
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c
index 6f1ec76784..7751d14295 100644
--- a/rts/sm/NonMoving.c
+++ b/rts/sm/NonMoving.c
@@ -865,6 +865,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");
diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c
index 77f0e1f5ea..aa5e62f738 100644
--- a/rts/sm/NonMovingMark.c
+++ b/rts/sm/NonMovingMark.c
@@ -1658,6 +1658,7 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin)
}
case TSO:
+ debugBelch("Marked TSO %p\n", p);
mark_tso(queue, (StgTSO *) p);
break;
@@ -2008,6 +2009,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.
@@ -2030,6 +2034,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:
diff --git a/rts/sm/NonMovingScav.c b/rts/sm/NonMovingScav.c
index f4c14aa4b4..cf8175d057 100644
--- a/rts/sm/NonMovingScav.c
+++ b/rts/sm/NonMovingScav.c
@@ -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;
}