From 701256df88c61a2eee4cf00a59e61ef76a57b4b4 Mon Sep 17 00:00:00 2001 From: David Feuer Date: Wed, 1 Mar 2017 01:14:13 -0500 Subject: Change catch# demand signature * Give `catch#` a lazy demand signature, to make it more honest. * Make `catchException` and `catchAny` force their arguments so they actually behave as advertised. * Use `catch` rather than `catchException` in `forkIO`, `forkOn`, and `forkOS` to avoid losing exceptions. Fixes #13330 Reviewers: rwbarton, simonpj, simonmar, bgamari, hvr, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3244 --- compiler/basicTypes/Demand.hs | 2 +- compiler/prelude/primops.txt.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler') diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 71a044f51f..eab01d0605 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -708,7 +708,7 @@ lazyApply1Dmd, lazyApply2Dmd, strictApply1Dmd, catchArgDmd :: Demand strictApply1Dmd = JD { sd = Str VanStr (SCall HeadStr) , ud = Use Many (UCall One Used) } --- First argument of catch#: +-- First argument of catchRetry# and catchSTM#: -- uses its arg once, applies it once -- and catches exceptions (the ExnStr) part catchArgDmd = JD { sd = Str ExnStr (SCall HeadStr) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index f1ee3b36b0..855bdfcb62 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1965,7 +1965,7 @@ primop CatchOp "catch#" GenPrimOp -> State# RealWorld -> (# State# RealWorld, a #) with - strictness = { \ _arity -> mkClosedStrictSig [ catchArgDmd + strictness = { \ _arity -> mkClosedStrictSig [ lazyApply1Dmd , lazyApply2Dmd , topDmd] topRes } -- See Note [Strictness for mask/unmask/catch] -- cgit v1.2.1