Could MIR (eventually) be used to compile a language with tail call elimination? #409
Unanswered
jgonggrijp
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From the blog posts, the README and a few other discussions, I understand that MIR currently assumes the C calling convention. Given that tail call elimination (TCE) is not doable with that convention, that seems to suggest that TCE is, at least for now, out of reach for any compiler targeting MIR (at least without trampolining or complicated heuristic code transformations). Although the thing going on with thunks might create opportunities here? I don't understand enough about the inner workings of MIR, or compilers in general for that matter, to draw my own conclusions on that front.
Functional programming languages often like to employ tail call elimination as a loop primitive. Are such languages within the scope of MIR, or do you plan to support them in the future? What would be your advice to someone who wants to implement such a language and benefit from the high speed, low latency execution profile that MIR offers?
In any case, thank you for this very interesting project!
Beta Was this translation helpful? Give feedback.
All reactions