Confused about PAP object layout

Alexis King lexi.lambda at gmail.com
Fri Feb 14 15:43:40 UTC 2020


Disclaimer: I am not an expert. But I happened to have been looking at this code just yesterday, so I’ll try to answer to check my understanding. :)

Fundamentally, a PAP is not fully-saturated, so the number of arguments in its payload may be smaller than the information contained in the function’s bitmap. scavenge_large_bitmap calls walk_large_bitmap, which uses the bitmap as a “ruler” to guide the traversal, lining up each element in the payload to information in the bitmap. But the traversal only actually walks a payload of the specified size, so if there’s less information in the payload than there is information in the bitmap, the traversal will just terminate early.

> On Feb 14, 2020, at 09:30, Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:
> 
> Right, I think that's the problem. We then pass the same "size" to
> scavenge_large_bitmap as the size of the bitmap. So we assume size of the bitmap
> is pap->n_args.
> 
> So the call stack is
> 
> - scavenge_PAP, calls scavenge_PAP_payload with pap->n_args as "size"
> - scavenge_PAP_payload, calls scavenge_large_bitmap with "size" (== pap->n_args)
>  as the bitmap's size
> 
> Is this expected?
> 
> Ömer


More information about the ghc-devs mailing list