Commit ebfc2fb8 authored by Simon Marlow's avatar Simon Marlow

Update comments around blackholes

Test Plan: validate

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision:
parent 62fcf051
......@@ -355,17 +355,12 @@ retry:
(P_ node)
jump ENTRY_LBL(stg_BLACKHOLE) (node);
// CAF_BLACKHOLE is allocated when entering a CAF. The reason it is
// distinct from BLACKHOLE is so that we can tell the difference
// between an update frame on the stack that points to a CAF under
// evaluation, and one that points to a closure that is under
// evaluation by another thread (a BLACKHOLE). See threadPaused().
// evaluation by another thread (a BLACKHOLE). see Note [suspend
// duplicate work] in ThreadPaused.c
(P_ node)
jump ENTRY_LBL(stg_BLACKHOLE) (node);
// EAGER_BLACKHOLE exists for the same reason as CAF_BLACKHOLE (see above).
(P_ node)
jump ENTRY_LBL(stg_BLACKHOLE) (node);
{ foreign "C" barf("BLOCKING_QUEUE_CLEAN object entered!") never returns; }
......@@ -211,9 +211,8 @@ threadPaused(Capability *cap, StgTSO *tso)
maybePerformBlockedException (cap, tso);
if (tso->what_next == ThreadKilled) { return; }
// NB. Blackholing is *compulsory*, we must either do lazy
// blackholing, or eager blackholing consistently. See Note
// [upd-black-hole] in sm/Scav.c.
// NB. Updatable thunks *must* be blackholed, either by eager blackholing or
// lazy blackholing. See Note [upd-black-hole] in sm/Scav.c.
stack_end = tso->stackobj->stack + tso->stackobj->stack_size;
......@@ -244,6 +243,8 @@ threadPaused(Capability *cap, StgTSO *tso)
// Note [suspend duplicate work]
// If the info table is a WHITEHOLE or a BLACKHOLE, then
// another thread has claimed it (via the SET_INFO()
// below), or is in the process of doing so. In that case
......@@ -1807,6 +1807,7 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
switch (info->i.type) {
// Note [upd-black-hole]
// In SMP, we can get update frames that point to indirections
// when two threads evaluate the same thunk. We do attempt to
// discover this situation in threadPaused(), but it's
......@@ -1832,7 +1833,6 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
// compulsory (otherwise we would have to check for thunks
// too).
// Note [upd-black-hole]
// One slight hiccup is that the THUNK_SELECTOR machinery can
// overwrite the updatee with an IND. In parallel GC, this
// could even be happening concurrently, so we can't check for
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment