summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2009-11-06 14:58:30 +0000
committersimonpj@microsoft.com <unknown>2009-11-06 14:58:30 +0000
commitd7bc4e06c0b16d242f1f26100f4146f40f5de5a8 (patch)
tree28059076ea3919796840916024717c3537675fb6 /compiler
parent0b2de03568d3acf8143ff7f6dde103099bf8ff1a (diff)
downloadhaskell-d7bc4e06c0b16d242f1f26100f4146f40f5de5a8.tar.gz
Comments in OccurAnal
Diffstat (limited to 'compiler')
-rw-r--r--compiler/simplCore/OccurAnal.lhs2
-rw-r--r--compiler/typecheck/TcInstDcls.lhs16
2 files changed, 10 insertions, 8 deletions
diff --git a/compiler/simplCore/OccurAnal.lhs b/compiler/simplCore/OccurAnal.lhs
index a3e37325c7..f4eacd9ba7 100644
--- a/compiler/simplCore/OccurAnal.lhs
+++ b/compiler/simplCore/OccurAnal.lhs
@@ -177,7 +177,7 @@ However things are made quite a bit more complicated by RULES. Remember
"loop"? In particular, a RULE is like an equation for 'f' that
is *always* inlined if it is applicable. We do *not* disable
rules for loop-breakers. It's up to whoever makes the rules to
- make sure that the rules themselves alwasys terminate. See Note
+ make sure that the rules themselves always terminate. See Note
[Rules for recursive functions] in Simplify.lhs
Hence, if
diff --git a/compiler/typecheck/TcInstDcls.lhs b/compiler/typecheck/TcInstDcls.lhs
index 426da52201..4d614e2c5e 100644
--- a/compiler/typecheck/TcInstDcls.lhs
+++ b/compiler/typecheck/TcInstDcls.lhs
@@ -122,16 +122,16 @@ Running example:
{-# RULE "op1@C[a]" forall a, d:C a.
op1 [a] (df_i d) = op1_i a d #-}
-* The dictionary function itself is inlined as vigorously as we
+* We want to inline the dictionary function itself as vigorously as we
possibly can, so that we expose that dictionary constructor to
- selectors as much as poss. That is why the op_i stuff is in
- *separate* bindings, so that the df_i binding is small enough
- to inline. See Note [Inline dfuns unconditionally].
+ selectors as much as poss. We don't actually inline it; rather, we
+ use a Builtin RULE for the ClassOps (see MkId.mkDictSelId) to short
+ circuit such applications. But the RULE only applies if it can "see"
+ the dfun's DFunUnfolding.
* Note that df_i may be mutually recursive with both op1_i and op2_i.
It's crucial that df_i is not chosen as the loop breaker, even
though op1_i has a (user-specified) INLINE pragma.
- Not even once! Else op1_i, op2_i may be inlined into df_i.
* Instead the idea is to inline df_i into op1_i, which may then select
methods from the MkC record, and thereby break the recursion with
@@ -142,8 +142,10 @@ Running example:
* If op1_i is marked INLINE by the user there's a danger that we won't
inline df_i in it, and that in turn means that (since it'll be a
loop-breaker because df_i isn't), op1_i will ironically never be
- inlined. We need to fix this somehow -- perhaps allowing inlining
- of INLINE functions inside other INLINE functions.
+ inlined. But this is OK: the recursion breaking happens by way of
+ a RULE (the magic ClassOp rule above), and RULES work inside InlineRule
+ unfoldings. See Note [RULEs enabled in SimplGently] in SimplUtils
+
Note [Subtle interaction of recursion and overlap]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~