Min closure payload size?

Ömer Sinan Ağacan omeragacan at gmail.com
Mon Feb 4 13:23:19 UTC 2019


I was trying to understand why some info tables that have no ptrs and nptrs like
GCD_CAF end up with 1 nptrs in the generated info table and found this code in

    /* -----------------------------------------------------------------------------
       Minimum closure sizes

       This is the minimum number of words in the payload of a
       heap-allocated closure, so that the closure has enough room to be
       overwritten with a forwarding pointer during garbage collection.

    #define MIN_PAYLOAD_SIZE 1

We use this in a few places in the compiler and add at least one word space in
the payload. However the comment is actually wrong, forwarding pointers are made
by tagging the info ptr field so we don't need a word in the payload for
forwarding pointers. I tried updating this as 0 but that caused a lot of test
failures (mostly in GHCi). I'm wondering if I'm missing anything or is it just
some code assuming min payload size 1 without using this macro.

Any ideas?


More information about the ghc-devs mailing list