From 321d1bd8a79ab39c3c9e8697fffb0107c43f83cf Mon Sep 17 00:00:00 2001 From: Sebastian Graf <sebastian.graf@kit.edu> Date: Tue, 3 Nov 2020 18:28:49 +0100 Subject: [PATCH] Fix strictness signatures of `prefetchValue*#` primops Their strictness signatures said the primops are strict in their first argument, which is wrong: Handing it a thunk will prefetch the pointer to the thunk, but not evaluate it. Hence not strict. The regression test `T8256` actually tests for laziness in the first argument, so GHC apparently never exploited the strictness signature. See also https://gitlab.haskell.org/ghc/ghc/-/issues/8256#note_310867, where this came up. --- compiler/GHC/Builtin/primops.txt.pp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/compiler/GHC/Builtin/primops.txt.pp b/compiler/GHC/Builtin/primops.txt.pp index acee822b0cf0..74abca2927e3 100644 --- a/compiler/GHC/Builtin/primops.txt.pp +++ b/compiler/GHC/Builtin/primops.txt.pp @@ -3519,8 +3519,7 @@ primop PrefetchAddrOp3 "prefetchAddr3#" GenPrimOp primop PrefetchValueOp3 "prefetchValue3#" GenPrimOp a -> State# s -> State# s - with strictness = { \ _arity -> mkClosedStrictSig [botDmd, topDmd] topDiv } - has_side_effects = True + with has_side_effects = True ---- primop PrefetchByteArrayOp2 "prefetchByteArray2#" GenPrimOp @@ -3537,8 +3536,7 @@ primop PrefetchAddrOp2 "prefetchAddr2#" GenPrimOp primop PrefetchValueOp2 "prefetchValue2#" GenPrimOp a -> State# s -> State# s - with strictness = { \ _arity -> mkClosedStrictSig [botDmd, topDmd] topDiv } - has_side_effects = True + with has_side_effects = True ---- primop PrefetchByteArrayOp1 "prefetchByteArray1#" GenPrimOp @@ -3555,8 +3553,7 @@ primop PrefetchAddrOp1 "prefetchAddr1#" GenPrimOp primop PrefetchValueOp1 "prefetchValue1#" GenPrimOp a -> State# s -> State# s - with strictness = { \ _arity -> mkClosedStrictSig [botDmd, topDmd] topDiv } - has_side_effects = True + with has_side_effects = True ---- primop PrefetchByteArrayOp0 "prefetchByteArray0#" GenPrimOp @@ -3573,8 +3570,7 @@ primop PrefetchAddrOp0 "prefetchAddr0#" GenPrimOp primop PrefetchValueOp0 "prefetchValue0#" GenPrimOp a -> State# s -> State# s - with strictness = { \ _arity -> mkClosedStrictSig [botDmd, topDmd] topDiv } - has_side_effects = True + with has_side_effects = True ------------------------------------------------------------------------ --- --- -- GitLab