j-mie6/ParsleyHaskell

The `Jump` instruction is useless

Closed this issue · 2 comments

j-mie6 commented

Since parsley can perform generic eta-reduction on Template Haskell terms, the tail-call optimisation with Jump is actually useless.

Its original motivation was to allow call nt ret to be converted to jump nt, which would avoid constructing a new return continuation to pass down. However, the form of the return continuation in call nt ret would be x input -> retCont x input, which is ultimately eta-reduced to retCont, which is what is provided by Jump.

As such, for simplicity, it will be good to drop the Jump instruction, and ensure eta-reduction is rolled out uniformly, including to the normalisation within Lam.

j-mie6 commented

Actually, not true! Loop still uses it to iterate...

j-mie6 commented

But this could be Call nt Ret or even Call nt Raise, it doesn't really matter, the retCont for a loop is Void...