
#13236: Improve floating for join points -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: JoinPoints Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by lukemaurer): **Question 1.** For nullary join points, yes, this would definitely be a better way to “ruin” them. It would just be a matter of calling `lvlMFE` instead of `lvlExpr` in `lvlFloatRhs` when looking at the RHS of a join point. For going to top level, we could do something similar to perform the operation (have the join point delegate to a function), but to make the decision we still need special logic saying the function must be going either to top level or not above the join ceiling. Otherwise we can end up with: {{{ f a b = joinrec j1 x y = join j2 z = ... a ... b ... {- no x or y -} in ... in ... }}} becoming: {{{ f a b = let h z = ... a ... b ... joinrec j1 x y = join j2 z = h z in ... in ... }}} at which point `j2` goes away and is effectively “ruined” just as if we weren't careful with join points at all. **Question 2.** It happens, for instance in `circsim`, where a case branch that's a jump gets MFE'd. There's no more or less reason to float an MFE as a join point than to float an join point at all, AFAIK. **Question 3.** There's a Note [Join points] in `FloatOut` (maybe should be `SetLevels` instead?) with an example. Note that the simplifier wouldn't be able to do the floating to flatten the nested cases, since it would need to know the free variables of `j2` and `j3` to float them. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13236#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler