diff options
author | Josh Meredith <joshmeredith2008@gmail.com> | 2023-04-11 06:07:35 +0000 |
---|---|---|
committer | Josh Meredith <joshmeredith2008@gmail.com> | 2023-04-26 10:35:06 +0000 |
commit | eba7b247f31a420cae64d0ee87d7296bf434724e (patch) | |
tree | ff20a73518f78cfa52a6cd7c2b956b98d8a1dd33 /compiler/GHC/StgToJS/CodeGen.hs | |
parent | 74c557121fbcae32abd3b4a69513f8aa7d536073 (diff) | |
download | haskell-wip/js-stgrhsclosure.tar.gz |
Refactor GenStgRhs to include the Type in both constructors (#23280, #22576, #22364)wip/js-stgrhsclosure
Carry the actual type of an expression through the PreStgRhs and into GenStgRhs
for use in later stages. Currently this is used in the JavaScript backend to fix
some tests from the above mentioned issues: EtaExpandLevPoly, RepPolyWrappedVar2,
T13822, T14749.
Diffstat (limited to 'compiler/GHC/StgToJS/CodeGen.hs')
-rw-r--r-- | compiler/GHC/StgToJS/CodeGen.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/GHC/StgToJS/CodeGen.hs b/compiler/GHC/StgToJS/CodeGen.hs index 55be51df9d..fdc431ef4c 100644 --- a/compiler/GHC/StgToJS/CodeGen.hs +++ b/compiler/GHC/StgToJS/CodeGen.hs @@ -290,10 +290,10 @@ genToplevelDecl i rhs = do genToplevelConEntry :: Id -> CgStgRhs -> G JStat genToplevelConEntry i rhs = case rhs of - StgRhsCon _cc con _mu _ts _args + StgRhsCon _cc con _mu _ts _args _typ | isDataConWorkId i -> genSetConInfo i con (stgRhsLive rhs) -- NoSRT - StgRhsClosure _ _cc _upd_flag _args _body + StgRhsClosure _ _cc _upd_flag _args _body _typ | Just dc <- isDataConWorkId_maybe i -> genSetConInfo i dc (stgRhsLive rhs) -- srt _ -> pure mempty @@ -321,11 +321,11 @@ mkDataEntry = ValExpr $ JFunc [] returnStack genToplevelRhs :: Id -> CgStgRhs -> G JStat -- general cases: genToplevelRhs i rhs = case rhs of - StgRhsCon cc con _mu _tys args -> do + StgRhsCon cc con _mu _tys args _typ -> do ii <- identForId i allocConStatic ii cc con args return mempty - StgRhsClosure _ext cc _upd_flag {- srt -} args body -> do + StgRhsClosure _ext cc _upd_flag {- srt -} args body typ -> do {- algorithm: - collect all Id refs that are in the global id cache @@ -335,7 +335,7 @@ genToplevelRhs i rhs = case rhs of -} eid@(TxtI eidt) <- identForEntryId i (TxtI idt) <- identForId i - body <- genBody (initExprCtx i) i R2 args body + body <- genBody (initExprCtx i) R2 args body typ global_occs <- globalOccs (jsSaturate (Just "ghcjs_tmp_sat_") body) let lidents = map global_ident global_occs let lids = map global_id global_occs |