Add JStg IR
This MR is the next step on the path towards #22736, #22261 (specifically the GHCJS optimizer) and #22352 (closed).
We make progress towards these goals by splitting the current pipeline to add a new IR JStg
that serves as the first target for StgToJS
. We then write the RTS in JStg
and and eventually compile to the original JExpr
. In this way we split GHCJS's original design so that we can use JExpr
and friends for lower level optimization passes, but write hand-crafted code in JStg.
An decent analogy is to think of JStg
as Stg and JExpr
as Cmm but for the JS backend. So that the pipeline this MR creates looks like this:
STG
---- {stgToJStg code generator}
JStg <--{eDSL interpreter}-- eDSL
---- {jstgToJS code generator}
JS
---- {Linker}
JS
---- {Pretty-printer}
Raw JS
ToDos:
-
CI passes - [ ] update note inWont do until we settle on an optimizer architecture. See #22736.JStgToJS
with pipeline visualization -
add guidance comments on type classes -
fixup Prim module -
rebase -
squash
Edited by jeffrey young