Is this the correct way to get Stg for a module?

Christopher Done chrisdone at gmail.com
Fri Feb 15 12:30:48 UTC 2019


Hi all,

I'm attempting to get the Stg for a module with the intention of
interpreting it myself.

Here is a self-contained GHC-8.4.3-specific test-case to get STG:

https://gist.github.com/chrisdone/08ef9e8447b71c9dadc5bba949cda638#file-printstgghc8_4_3-hs-L47-L76

I'm using the handy helpers GHC.parseModule, GHC.typecheckModule,
GHC.desugarModule to get the Core. For getting the STG I copied what
is done in HscMain.hs in GHC, right before it generates Cmm:

https://github.com/ghc/ghc/blob/ghc-8.4/compiler/main/HscMain.hs#L1312-L1318

Can anyone confirm that the part I've highlighted in my Gist is the correct way
to get Stg? I can't really tell whether I missed anything or did
something wrong.

Cheers!


More information about the ghc-devs mailing list