[Git][ghc/ghc][wip/js-staging] StgToJS: comments on static args and optimizeFree
doyougnu (@doyougnu)
gitlab at gitlab.haskell.org
Fri Sep 30 13:17:39 UTC 2022
doyougnu pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
bed7d64a by doyougnu at 2022-09-30T09:17:28-04:00
StgToJS: comments on static args and optimizeFree
- - - - -
2 changed files:
- compiler/GHC/StgToJS/Expr.hs
- compiler/GHC/StgToJS/Types.hs
Changes:
=====================================
compiler/GHC/StgToJS/Expr.hs
=====================================
@@ -494,7 +494,14 @@ genStaticRefs lv
-- | Reorder the things we need to push to reuse existing stack values as much
-- as possible True if already on the stack at that location
-optimizeFree :: HasDebugCallStack => Int -> [Id] -> G [(Id,Int,Bool)]
+optimizeFree
+ :: HasDebugCallStack
+ => Int
+ -> [Id]
+ -> G [(Id,Int,Bool)] -- ^ A list of stack slots.
+ -- -- Id: stored on the slot
+ -- -- Int: the part of the value that is stored
+ -- -- Bool: True when the slot already contains a value
optimizeFree offset ids = do
-- this line goes wrong vvvvvvv
let -- ids' = concat $ map (\i -> map (i,) [1..varSize . uTypeVt . idType $ i]) ids
=====================================
compiler/GHC/StgToJS/Types.hs
=====================================
@@ -254,7 +254,9 @@ data StaticUnboxed
instance NFData StaticUnboxed
--- | Static Arguments
+-- | Static Arguments. Static Arguments are things that are statically
+-- allocated, i.e., they exist at program startup. These are static heap objects
+-- or literals or things that have been floated to the top level binding by ghc.
data StaticArg
= StaticObjArg !FastString -- ^ reference to a heap object
| StaticLitArg !StaticLit -- ^ literal
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bed7d64a1572c4cd677e72fb016be50404098b86
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bed7d64a1572c4cd677e72fb016be50404098b86
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/20220930/57c2b966/attachment-0001.html>
More information about the ghc-commits
mailing list