[commit: ghc] master: Mark retry# as returning bottom. (e2b72ca)
git at git.haskell.org
git at git.haskell.org
Sun Aug 11 07:06:17 CEST 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/e2b72cadce3ae799a74981f9957b40bb201f1ba1/ghc
>---------------------------------------------------------------
commit e2b72cadce3ae799a74981f9957b40bb201f1ba1
Author: Austin Seipp <aseipp at pobox.com>
Date: Sat Aug 10 22:39:15 2013 -0500
Mark retry# as returning bottom.
This change helps the simplifier eliminate unreachable code, since
retry# technically doesn't return.
This closes ticket #8091.
Authored-by: Patrick Palka <patrick at parcs.ath.cx>
Signed-off-by: Austin Seipp <aseipp at pobox.com>
>---------------------------------------------------------------
e2b72cadce3ae799a74981f9957b40bb201f1ba1
compiler/prelude/primops.txt.pp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 3d3518b..0c325a6 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -1611,9 +1611,24 @@ primop AtomicallyOp "atomically#" GenPrimOp
out_of_line = True
has_side_effects = True
+-- NB: retry#'s strictness information specifies it to return bottom.
+-- This lets the compiler perform some extra simplifications, since retry#
+-- will technically never return.
+--
+-- This allows the simplifier to replace things like:
+--
+-- case retry# s1
+-- (# s2, a #) -> e
+--
+-- with:
+--
+-- retry# s1
+--
+-- where 'e' would be unreachable anyway.
primop RetryOp "retry#" GenPrimOp
State# RealWorld -> (# State# RealWorld, a #)
with
+ strictness = { \ _arity -> mkStrictSig (mkTopDmdType [topDmd] botRes) }
out_of_line = True
has_side_effects = True
More information about the ghc-commits
mailing list