Confused about PAP object layout

Ben Gamari ben at
Fri Feb 14 15:53:13 UTC 2020

Ömer Sinan Ağacan <omeragacan at> writes:

> 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?
Omer and I discussed this via IRC.

I believe that the intent here is that scavenge_PAP_payload scavenges
precisely the number of arguments that the PAP's stack fragment
includes, using the function's bitmap to do so (since we must know which
of this arguments are pointers).

Moreover, we know that pap->n_args is less or equal to than the size of
the bitmap (since otherwise this wouldn't be a partial application).
Consequently this is safe and correct.


- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list