Min closure payload size?

Ömer Sinan Ağacan omeragacan at gmail.com
Wed Feb 6 05:40:08 UTC 2019


I don't think so, for two reasons:

- We update static thunks just fine so I don't think they're in a read-only
  section.

- Forwarding pointers are needed when moving objects, and we don't move static
  objects, so we don't need to make them forwarding pointers (I think you
  confused forwarding pointers with indirections generated by thunk updates?).

Ömer

Gabor Greif <ggreif at gmail.com>, 6 Şub 2019 Çar, 03:47 tarihinde şunu yazdı:
>
> Just guessing here, maybe this thunk type lives in (read-only?) static
> sections, and as such it will never be overwritten with forwarding
> pointers?
>
>     Gabor
>
> On 2/5/19, Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:
> > 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
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> >


More information about the ghc-devs mailing list