Min closure payload size?

Simon Peyton Jones simonpj at microsoft.com
Tue Feb 5 14:33:56 UTC 2019


I'm relying on Simon M here.  I'm out of my depth!

Simon

| -----Original Message-----
| From: ghc-devs <ghc-devs-bounces at haskell.org> On Behalf Of Ömer Sinan
| Agacan
| Sent: 05 February 2019 13:38
| To: ghc-devs <ghc-devs at haskell.org>
| Subject: Re: Min closure payload size?
| 
| I just came across a closure that is according to this code is not valid:
| 
|     >>> print *get_itbl(0x7b2870)
|     $8 = {
|       layout = {
|         payload = {
|           ptrs = 0,
|           nptrs = 0
|         },
|         bitmap = 0,
|         large_bitmap_offset = 0,
|         __pad_large_bitmap_offset = 0,
|         selector_offset = 0
|       },
|       type = 21,
|       srt = 3856568,
|       code = 0x404ef0 <r1Al_info>
| "H\215E\360L9\370rDH\203\354\bL\211\350H\211\336H\211\307\061\300\350|\034\
| 062"
|     }
| 
| This is a THUNK_STATIC with 0 ptrs and nptrs in the payload.
| 
| Ömer
| 
| Ömer Sinan Ağacan <omeragacan at gmail.com>, 4 Şub 2019 Pzt, 16:23
| tarihinde şunu yazdı:
| >
| > Hi,
| >
| > 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
| > Constants.h:
| >
| >     /* ------------------------------------------------------------------
| -----------
| >        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?
| >
| > Ömer
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at haskell.org
| https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haske
| ll.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
| devs&data=02%7C01%7Csimonpj%40microsoft.com%7C4297c3983d594168ad0b08d68
| b6f3d32%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636849707211774471&amp
| ;sdata=H4sLNvWnJHxdHo1hjdC0fU3pUL3K1AUjV4nC3tHlBEU%3D&reserved=0


More information about the ghc-devs mailing list