[commit: ghc] wip/raiseIO-conservative: Make raiseIO# produce topRes (da4687f)

git at git.haskell.org git at git.haskell.org
Wed Mar 8 23:39:41 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/raiseIO-conservative
Link       : http://ghc.haskell.org/trac/ghc/changeset/da4687f63ffe5a6162e3d7856aa53de048dd0f42/ghc

>---------------------------------------------------------------

commit da4687f63ffe5a6162e3d7856aa53de048dd0f42
Author: David Feuer <David.Feuer at gmail.com>
Date:   Wed Mar 8 16:34:18 2017 -0500

    Make raiseIO# produce topRes
    
    Summary:
    Make `raiseIO#` produce `topRes` instead of `ExnRes`. `ExnRes`
    leads to demand analysis being too aggressive, IMO, allowing
    imprecise exceptions produced by `throw` to replace exceptions
    thrown by `throwIO` that  would like to think of as precise.
    
    This fixes that, but is certanly much more conservative than we
    would ideally like. Let's see how bad it is.
    
    Fixes Trac #13380
    
    Reviewers: austin, bgamari
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3301


>---------------------------------------------------------------

da4687f63ffe5a6162e3d7856aa53de048dd0f42
 compiler/prelude/primops.txt.pp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 1d10223..64971a3 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2005,11 +2005,9 @@ primop  RaiseOp "raise#" GenPrimOp
 -- must be *precise* - we don't want the strictness analyser turning
 -- one kind of bottom into another, as it is allowed to do in pure code.
 --
--- But we *do* want to know that it returns bottom after
--- being applied to two arguments, so that this function is strict in y
---     f x y | x>0       = raiseIO blah
---           | y>0       = return 1
---           | otherwise = return 2
+-- We currently produce topRes, which is much too conservative (interfering
+-- with dead code elimination, unfortunately), but nothing else we currently
+-- have on tap is actually correct.
 --
 -- TODO Check that the above notes on @f@ are valid. The function successfully
 -- produces an IO exception when compiled without optimization. If we analyze
@@ -2021,7 +2019,7 @@ primop  RaiseOp "raise#" GenPrimOp
 primop  RaiseIOOp "raiseIO#" GenPrimOp
    a -> State# RealWorld -> (# State# RealWorld, b #)
    with
-   strictness  = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] exnRes }
+   strictness  = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] topRes }
    out_of_line = True
    has_side_effects = True
 



More information about the ghc-commits mailing list