Simple question about blackholing

Hello, By all accounts I've found a thunk is blackholed by replacing its header with a (the) blackhole code pointer (or blackhole info pointer in the unregisterized case). My simple-minded question is how garbage collection can take place given that the layout of the payload is lost. Surely not a custom blackhole for each (statically defined) thunk? A list of blackholes maintained somewhere that the GC knows about? Thanks for any insight! Kei -- Kei Davis Applied Computer Science Group CCS-7, Mail Stop B287 Los Alamos National Laboratory Los Alamos, NM 87545, U.S.A.

I *believe* the answer is "Black holing happens as / after the thunk contents are copied to the stack, so the contents of the thunk are now dead and the data is live on a stack somewhere." -Jan

Jan, I suppose things could have changed since 2005, but taking "Haskell on a Shared-Memory Multiprocessor" (Harris, Marlow, Peyton Jones 2005) as the reference point, the figure in section 3.3 makes clear that a thunk's payload (free variables) remains valid until update with an indirection. The paper is also clear that there is only one header word, i.e., that a copy of the original header word isn't stashed in the header and that this header word is replaced with a blackhole (code pointer or info pointer). They do not state outright that such a copy isn't stashed in the payload together with the free variables, but if that were the case it would seem an odd omission given the level of detail otherwise. Kei On 09/16/2015 10:48 AM, Jan-Willem Maessen wrote:
I *believe* the answer is "Black holing happens as / after the thunk contents are copied to the stack, so the contents of the thunk are now dead and the data is live on a stack somewhere."
-Jan
-- Kei Davis Applied Computer Science Group CCS-7, Mail Stop B287 Los Alamos National Laboratory Los Alamos, NM 87545, U.S.A.

Whoops, quite right, and ThreadPaused.c (
https://ghc.haskell.org/trac/ghc/browser/ghc/rts/ThreadPaused.c) makes
clear that there's only one Blackhole tag.
On Wed, Sep 16, 2015 at 1:37 PM, Kei Davis
Jan,
I suppose things could have changed since 2005, but taking "Haskell on a Shared-Memory Multiprocessor" (Harris, Marlow, Peyton Jones 2005) as the reference point, the figure in section 3.3 makes clear that a thunk's payload (free variables) remains valid until update with an indirection.
The paper is also clear that there is only one header word, i.e., that a copy of the original header word isn't stashed in the header and that this header word is replaced with a blackhole (code pointer or info pointer). They do not state outright that such a copy isn't stashed in the payload together with the free variables, but if that were the case it would seem an odd omission given the level of detail otherwise.
Kei
On 09/16/2015 10:48 AM, Jan-Willem Maessen wrote:
I *believe* the answer is "Black holing happens as / after the thunk contents are copied to the stack, so the contents of the thunk are now dead and the data is live on a stack somewhere."
-Jan
-- Kei Davis Applied Computer Science Group CCS-7, Mail Stop B287 Los Alamos National Laboratory Los Alamos, NM 87545, U.S.A.
participants (2)
-
Jan-Willem Maessen
-
Kei Davis