Skip to content
This repository has been archived by the owner on Feb 3, 2019. It is now read-only.

Tail call FSM #12

Open
arrdem opened this issue Jun 16, 2014 · 0 comments
Open

Tail call FSM #12

arrdem opened this issue Jun 16, 2014 · 0 comments
Assignees

Comments

@arrdem
Copy link
Owner

arrdem commented Jun 16, 2014

Tail calls of F can be famously rewritten into a GOTO as mentioned in #11. Another property of the tail call structure is that for f and g mutually tail recursive f and g can be rewritten into a finite state machine h such that when f returns (apply g x) this is simply a bytecode jump with no stack operations rather than being a stack call.

Such FSM transformation is valid if and only f and g (and potentially more functions) form a call graph clique where mutual calls occur only from the tail position. Mutually recursive calls not in the tail position cannot be rewritten as such.

Honestly I don't think a whole lot of Clojure code is structured such that this would be a valuable transform, but it would be interesting to build the requisite call graph clique analysis and see if that is in fact the case.

@arrdem arrdem self-assigned this Jun 16, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant