summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToJS/CodeGen.hs
diff options
context:
space:
mode:
authordoyougnu <jeffrey.young@iohk.io>2023-03-15 11:01:03 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-03-30 01:40:08 -0400
commitb159e0e94f8d049198947965046b6a5edbd89c36 (patch)
tree4edd4755aed0d7c4043f6fa008acff8692a69549 /compiler/GHC/StgToJS/CodeGen.hs
parent41a572f656c04770366c29ef5554184cf685482f (diff)
downloadhaskell-b159e0e94f8d049198947965046b6a5edbd89c36.tar.gz
js: split JMacro into JS eDSL and JS syntax
This commit: Splits JExpr and JStat into two nearly identical DSLs: - GHC.JS.Syntax is the JMacro based DSL without unsaturation, i.e., a value cannot be unsaturated, or, a value of this DSL is a witness that a value of GHC.JS.Unsat has been saturated - GHC.JS.Unsat is the JMacro DSL from GHCJS with Unsaturation. Then all binary and outputable instances are changed to use GHC.JS.Syntax. This moves us closer to closing out #22736 and #22352. See #22736 for roadmap. ------------------------- Metric Increase: CoOpt_Read LargeRecord ManyAlternatives PmSeriesS PmSeriesT PmSeriesV T10421 T10858 T11195 T11374 T11822 T12227 T12707 T13035 T13253 T13253-spj T13379 T14683 T15164 T15703 T16577 T17096 T17516 T17836 T18140 T18282 T18304 T18478 T18698a T18698b T18923 T1969 T19695 T20049 T21839c T3064 T4801 T5321FD T5321Fun T5631 T5642 T783 T9198 T9233 T9630 TcPlugin_RewritePerf WWRec -------------------------
Diffstat (limited to 'compiler/GHC/StgToJS/CodeGen.hs')
-rw-r--r--compiler/GHC/StgToJS/CodeGen.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/StgToJS/CodeGen.hs b/compiler/GHC/StgToJS/CodeGen.hs
index 7703398aea..55be51df9d 100644
--- a/compiler/GHC/StgToJS/CodeGen.hs
+++ b/compiler/GHC/StgToJS/CodeGen.hs
@@ -13,7 +13,7 @@ import GHC.Prelude
import GHC.Driver.Flags (DumpFlag (Opt_D_dump_js))
import GHC.JS.Ppr
-import GHC.JS.Syntax
+import GHC.JS.Unsat.Syntax
import GHC.JS.Make
import GHC.JS.Transform
@@ -134,6 +134,7 @@ genUnits m ss spt_entries foreign_stubs = do
staticInit <-
initStaticPtrs spt_entries
let stat = ( -- O.optimize .
+ satJStat .
jsSaturate (Just $ modulePrefix m 1)
$ mconcat (reverse glbl) <> staticInit)
let syms = [moduleGlobalSymbol m]
@@ -207,7 +208,7 @@ genUnits m ss spt_entries foreign_stubs = do
_extraTl <- State.gets (ggsToplevelStats . gsGroup)
si <- State.gets (ggsStatic . gsGroup)
let body = mempty -- mconcat (reverse extraTl) <> b1 ||= e1 <> b2 ||= e2
- let stat = jsSaturate (Just $ modulePrefix m n) body
+ let stat = satJStat $ jsSaturate (Just $ modulePrefix m n) body
let ids = [bnd]
syms <- (\(TxtI i) -> [i]) <$> identForId bnd
let oi = ObjUnit
@@ -245,6 +246,7 @@ genUnits m ss spt_entries foreign_stubs = do
topDeps = collectTopIds decl
required = hasExport decl
stat = -- Opt.optimize .
+ satJStat .
jsSaturate (Just $ modulePrefix m n)
$ mconcat (reverse extraTl) <> tl
syms <- mapM (fmap (\(TxtI i) -> i) . identForId) topDeps