summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreSyn.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-03-17 16:25:41 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-03-17 16:31:13 +0000
commita7dbafe9292212f3cbc21be42eb326ab0701db7e (patch)
tree491cefd34aa9c60948e161469eaa7fccd592d051 /compiler/coreSyn/CoreSyn.hs
parent567bc6bd194836233ce1576acd7a62b1867f6607 (diff)
downloadhaskell-a7dbafe9292212f3cbc21be42eb326ab0701db7e.tar.gz
No join-point from an INLINE function with wrong arity
The main payload of this patch is NOT to make a join-point from a function with an INLINE pragma and the wrong arity; see Note [Join points and INLINE pragmas] in CoreOpt. This is what caused Trac #13413. But we must do the exact same thing in simpleOptExpr, which drove me to the following refactoring: * Move simpleOptExpr and simpleOptPgm from CoreSubst to a new module CoreOpt along with a few others (exprIsConApp_maybe, pushCoArg, etc) This eliminates a module loop altogether (delete CoreArity.hs-boot), and stops CoreSubst getting too huge. * Rename Simplify.matchOrConvertToJoinPoint to joinPointBinding_maybe Move it to the new CoreOpt Use it in simpleOptExpr as well as in Simplify * Define CoreArity.joinRhsArity and use it
Diffstat (limited to 'compiler/coreSyn/CoreSyn.hs')
-rw-r--r--compiler/coreSyn/CoreSyn.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs
index ad504ac1b9..6762ed6fb2 100644
--- a/compiler/coreSyn/CoreSyn.hs
+++ b/compiler/coreSyn/CoreSyn.hs
@@ -589,6 +589,11 @@ Join points must follow these invariants:
"join arity" (to distinguish from regular arity, which only counts values).
2. For join arity n, the right-hand side must begin with at least n lambdas.
+ No ticks, no casts, just lambdas! C.f. CoreUtils.joinRhsArity.
+
+ 2a. Moreover, this same constraint applies to any unfolding of the binder.
+ Reason: if we want to push a continuation into the RHS we must push it
+ into the unfolding as well.
3. If the binding is recursive, then all other bindings in the recursive group
must also be join points.