Opened 3 years ago

Closed 3 years ago

#13382 closed bug (fixed)

Join ceilings incorrectly getting placed outside value lambdas by SetLevels

Reported by: lukemaurer Owned by: lukemaurer
Priority: normal Milestone: 8.2.1
Component: Compiler Version: 8.1
Keywords: JoinPoints Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

This is a latent bug, so there's no test case.

Given code like

let f = \x y z -> e1 in e2

we have SetLevels put a “join ceiling” around e1 to be sure that we don't let a join point float out, since any jump to that join point from e1 would be invalid. However, an oversight in lvlFloatRhs has us putting the join ceiling around the lambdas instead—in other words, it appears that we might produce

let f =
  join j = ... in \x y z -> ... jump j ...
in e2

(which is wrong because you can't jump out of a lambda) rather than

let f =
  \x y z -> join j = ... in ... jump j ...
in e2

As it happens, this bug is latent because of the way FloatOut and SetLevels interact. FloatOut correctly understands where the join ceiling should be. Then, at each join ceiling, FloatOut drops all bindings marked “float me to the nearest join ceiling,” so if j is so marked, the latter example (the correct one) is the result and not the former. Nonetheless, lvlFloatRhs as written is clearly wrong.

(This of course illustrates a shortcoming of the “join ceiling” scheme, at least as implemented: we rely on FloatOut and SetLevels agreeing on where the join ceilings are. It's easy to specify where they should be, but since there are two modules implementing them, we have twice the opportunities to get it wrong.)

Change History (4)

comment:1 Changed 3 years ago by lukemaurer

Owner: set to lukemaurer

comment:2 Changed 3 years ago by simonpj

I want to kill off the entire join-ceiling thing. I don't think FloatOut should float join-points at all. Instead the simplifier can, as it does now for local bindings.

comment:3 Changed 3 years ago by Ben Gamari <ben@…>

In 08e73cc/ghc:

Fix #13382: Put join ceiling underneath lambdas

Test Plan: No new test (bug is latent)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3285

comment:4 Changed 3 years ago by bgamari

Milestone: 8.2.1
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.