[Git][ghc/ghc][wip/js-staging] genToplevelConEntry: Fix for InferTags at Stg

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Mon Oct 31 17:41:44 UTC 2022



doyougnu pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
8aa1266e by doyougnu at 2022-10-31T13:34:12-04:00
genToplevelConEntry: Fix for InferTags at Stg

- - - - -


1 changed file:

- compiler/GHC/StgToJS/CodeGen.hs


Changes:

=====================================
compiler/GHC/StgToJS/CodeGen.hs
=====================================
@@ -46,7 +46,6 @@ import GHC.Types.ForeignStubs (ForeignStubs (..), getCHeader, getCStub)
 import GHC.Types.RepType
 import GHC.Types.Id
 import GHC.Types.Unique
-import GHC.Types.TyThing
 
 import GHC.Data.FastString
 import GHC.Utils.Encoding
@@ -289,14 +288,13 @@ genToplevelDecl i rhs = do
 
 genToplevelConEntry :: Id -> CgStgRhs -> G JStat
 genToplevelConEntry i rhs = case rhs of
-  StgRhsCon _cc con _mu _ts _args
-    | i `elem` [ i' | AnId i' <- dataConImplicitTyThings con ]
-    -> genSetConInfo i con (stgRhsLive rhs) -- NoSRT
-  StgRhsClosure _ _cc _upd_flag _args body
-    | StgConApp dc _n _cargs _tys <- removeTick body
-    , i `elem` [ i' | AnId i' <- dataConImplicitTyThings dc ]
-    -> genSetConInfo i dc (stgRhsLive rhs) -- srt
-  _ -> pure mempty
+   StgRhsCon _cc con _mu _ts _args
+     | isDataConWorkId i
+       -> genSetConInfo i con (stgRhsLive rhs) -- NoSRT
+   StgRhsClosure _ _cc _upd_flag _args _body
+     | Just dc <- isDataConWorkId_maybe i
+       -> genSetConInfo i dc (stgRhsLive rhs) -- srt
+   _ -> pure mempty
 
 genSetConInfo :: HasDebugCallStack => Id -> DataCon -> LiveVars -> G JStat
 genSetConInfo i d l {- srt -} = do



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8aa1266ea65512b11a3a2a922ca75764c99b2639

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8aa1266ea65512b11a3a2a922ca75764c99b2639
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221031/1f1c24ae/attachment-0001.html>


More information about the ghc-commits mailing list