/* doesn't matter where we evacuate values/finalizers to, since
* these pointers are treated as roots (iff the keys are alive).
*/
- evac_gen = 0;
+ gct->evac_gen = 0;
last_w = &old_weak_ptr_list;
for (w = old_weak_ptr_list; w != NULL; w = next_w) {
{
StgTSO *prev, *t, *tmp;
rtsBool flag;
+ nat type;
flag = rtsFalse;
prev = NULL;
for (t = blackhole_queue; t != END_TSO_QUEUE; prev=t, t = t->link) {
+ // if the thread is not yet alive...
if (! (tmp = (StgTSO *)isAlive((StgClosure*)t))) {
- if (isAlive(t->block_info.closure)) {
- t = (StgTSO *)evacuate((StgClosure *)t);
- if (prev) prev->link = t;
- flag = rtsTrue;
- }
+ // if the closure it is blocked on is either (a) a
+ // reachable BLAKCHOLE or (b) not a BLACKHOLE, then we
+ // make the thread alive.
+ if (!isAlive(t->block_info.closure)) {
+ type = get_itbl(t->block_info.closure)->type;
+ if (type == BLACKHOLE || type == CAF_BLACKHOLE) {
+ continue;
+ }
+ }
+ t = (StgTSO *)evacuate((StgClosure *)t);
+ if (prev) prev->link = t;
+ flag = rtsTrue;
}
}
return flag;