[Git][ghc/ghc][master] Provide a demand signature for atomicModifyMutVar.# (#23047)
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Jun 14 21:18:49 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
42000000 by Sebastian Graf at 2023-06-14T17:18:29-04:00
Provide a demand signature for atomicModifyMutVar.# (#23047)
Fixes #23047
- - - - -
2 changed files:
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Types/Demand.hs
Changes:
=====================================
compiler/GHC/Builtin/primops.txt.pp
=====================================
@@ -2489,6 +2489,7 @@ primop AtomicModifyMutVar2Op "atomicModifyMutVar2#" GenPrimOp
out_of_line = True
has_side_effects = True
can_fail = True
+ strictness = { \ _arity -> mkClosedDmdSig [ topDmd, lazyApply1Dmd, topDmd ] topDiv }
primop AtomicModifyMutVar_Op "atomicModifyMutVar_#" GenPrimOp
MutVar# s a -> (a -> a) -> State# s -> (# State# s, a, a #)
@@ -2499,6 +2500,7 @@ primop AtomicModifyMutVar_Op "atomicModifyMutVar_#" GenPrimOp
out_of_line = True
has_side_effects = True
can_fail = True
+ strictness = { \ _arity -> mkClosedDmdSig [ topDmd, lazyApply1Dmd, topDmd ] topDiv }
primop CasMutVarOp "casMutVar#" GenPrimOp
MutVar# s v -> v -> v -> State# s -> (# State# s, Int#, v #)
=====================================
compiler/GHC/Types/Demand.hs
=====================================
@@ -963,15 +963,15 @@ strictOnceApply1Dmd = C_11 :* mkCall C_11 topSubDmd
strictManyApply1Dmd :: Demand
strictManyApply1Dmd = C_1N :* mkCall C_1N topSubDmd
--- | First argument of catch#: @MC(M,L)@.
+-- | First argument of catch#: @MC(1,L)@.
-- Evaluates its arg lazily, but then applies it exactly once to one argument.
lazyApply1Dmd :: Demand
-lazyApply1Dmd = C_01 :* mkCall C_01 topSubDmd
+lazyApply1Dmd = C_01 :* mkCall C_11 topSubDmd
--- | Second argument of catch#: @MC(M,C(1,L))@.
--- Calls its arg lazily, but then applies it exactly once to an additional argument.
+-- | Second argument of catch#: @MC(1,C(1,L))@.
+-- Evaluates its arg lazily, but then applies it exactly once to two arguments.
lazyApply2Dmd :: Demand
-lazyApply2Dmd = C_01 :* mkCall C_01 (mkCall C_11 topSubDmd)
+lazyApply2Dmd = C_01 :* mkCall C_11 (mkCall C_11 topSubDmd)
-- | Make a 'Demand' evaluated at-most-once.
oneifyDmd :: Demand -> Demand
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/420000000e2d3d1a07ff3aa2a24cc88bd3d48e75
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/420000000e2d3d1a07ff3aa2a24cc88bd3d48e75
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/20230614/c8e819e6/attachment-0001.html>
More information about the ghc-commits
mailing list