[Git][ghc/ghc][wip/js-stgrhsclosure] lint

Josh Meredith (@JoshMeredith) gitlab at gitlab.haskell.org
Tue Apr 11 07:46:22 UTC 2023



Josh Meredith pushed to branch wip/js-stgrhsclosure at Glasgow Haskell Compiler / GHC


Commits:
c8e264d5 by Josh Meredith at 2023-04-11T07:46:10+00:00
lint

- - - - -


2 changed files:

- compiler/GHC/Stg/BcPrep.hs
- compiler/GHC/StgToJS/Expr.hs


Changes:

=====================================
compiler/GHC/Stg/BcPrep.hs
=====================================
@@ -79,7 +79,7 @@ bcPrepExpr (StgTick tick rhs) =
   StgTick tick <$> bcPrepExpr rhs
 bcPrepExpr (StgLet xlet bnds expr) =
   StgLet xlet <$> bcPrepBind bnds
-              <*> bcPrepExpr expr 
+              <*> bcPrepExpr expr
 bcPrepExpr (StgLetNoEscape xlne bnds expr) =
   StgLet xlne <$> bcPrepBind bnds
               <*> bcPrepExpr expr


=====================================
compiler/GHC/StgToJS/Expr.hs
=====================================
@@ -319,7 +319,7 @@ genBody ctx i startReg args e typ = do
 
   -- compute PrimReps and their number of slots required to return the result of
   -- i applied to args.
-  let res_vars = resultSize args i typ
+  let res_vars = resultSize typ
 
   -- compute typed expressions for each slot and assign registers
   let go_var regs = \case
@@ -360,23 +360,13 @@ genBody ctx i startReg args e typ = do
 -- In case of failure to determine the type, we default to LiftedRep as it's
 -- probably what it is.
 --
-resultSize :: HasDebugCallStack => [Id] -> Var -> Type -> [(PrimRep, Int)]
-resultSize args t ty = result
+resultSize :: HasDebugCallStack => Type -> [(PrimRep, Int)]
+resultSize ty = result
   where
     result       = result_reps `zip` result_slots
     result_slots = fmap (slotCount . primRepSize) result_reps
     result_reps  = typePrimRep ty
 
-    trim_args t 0 = typePrimRep t
-    trim_args t n
-      | Just (_af, _mult, arg, res) <- splitFunTy_maybe t
-      , nargs <- length (typePrimRepArgs arg)
-      , assert (n >= nargs) True
-      = trim_args (unwrapType res) (n - nargs)
-      | otherwise
-      = pprTrace "result_type: not a function type, assume LiftedRep" (ppr t)
-          [LiftedRep]
-
 -- | Ensure that the set of identifiers has valid 'RuntimeRep's. This function
 -- returns a no-op when 'csRuntimeAssert' in 'StgToJSConfig' is False.
 verifyRuntimeReps :: HasDebugCallStack => [Id] -> G JStat



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c8e264d555b1281518614db24463ea9502cf249c
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/20230411/ed4bc68c/attachment-0001.html>


More information about the ghc-commits mailing list