ghc-grin icon indicating copy to clipboard operation
ghc-grin copied to clipboard

Can the external core be fed back into GHC?

Open chrisdone opened this issue 2 years ago • 3 comments

One thing people sometimes want is to generate files of GHC’s bytecode. That can make for faster recompilation and even a way to build an “interpreted” exe, both of these could yield much faster dev cycles when the project is large and build times are more painful than runtime. On a project with 1000 modules and lots of TH, that recompiling of bytecode can hurt.

I’m wondering whether one could generate external STG when in GHC’s Interpreted linker mode.

Your external-stg looks like it goes in both directions: stg -> external stg and back. Are there any pitfalls/caveats to its current implementation?

I’m aware that its speed won’t be good because it’s using the binary package, but that’s easily swapped out for something more efficient.

chrisdone avatar Oct 16 '21 10:10 chrisdone

Is this the latest version of this code? https://github.com/grin-compiler/ghc-whole-program-compiler-project/tree/master/external-stg-compiler/lib/Stg/GHC

chrisdone avatar Oct 16 '21 10:10 chrisdone

Yes, the external-stg-compiler can feed back ext-stg to ghc for codegen. The latest code is available on github. The pipeline does not use the bytecode at all.

csabahruska avatar Oct 16 '21 11:10 csabahruska

GHC-WPC does not support external core, only ext-stg. The Core IR is always in flux, that's why.

csabahruska avatar Oct 16 '21 11:10 csabahruska