Peeking into StgInfoTable in cmm

Matthew Pickering matthewtpickering at gmail.com
Wed Feb 6 19:54:24 UTC 2019


Unless I am misunderstanding you want something which works like ghc-heap.

If so, perhaps these three files will be instructive?

https://gitlab.haskell.org/ghc/ghc/blob/master/libraries/ghc-heap/GHC/Exts/Heap/InfoTable.hsc
https://gitlab.haskell.org/ghc/ghc/blob/master/libraries/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc
https://gitlab.haskell.org/ghc/ghc/blob/master/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs#L25

Cheers,

Matt

On Wed, Feb 6, 2019 at 7:29 PM Andrew Martin <andrew.thaddeus at gmail.com> wrote:
>
> For an optimization I’m implementing, I’m trying to write an inline primop that gives me lets me inspect the closure type of an arbitrary heap-allocated value. I’m close to figuring this out, and the FCode machinery is starting to make sense, but one thing eludes me. Starting from a StgHeader, I get the info table pointer. This is easy since it’s the first field in the struct. But next I have to deference the info table pointer and get the closure type. There are two fields at the beginning of an info table that may or may not be present. I don’t know how to figure out if they are present or not. I suspect that there is something I can get out of DynFlags that tells me this, but I can’t find anything else in the stg-to-cmm pass that reads from an info table.
>
> Sent from my iPhone
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


More information about the Libraries mailing list