Re:Idris 2 0.6.0 is now available for the JVM
by dunham on Monday February 27, 2023 @11:16AM
(#34958155)
The javascript back end handles mutually recursive tail calls. It finds connected components and rewrites them to use a trampoline-like thing. There is a nice explanation of how it works at the top of the file:
One could argue that it's not "full" TCO, but it does cover a lot of use-cases. That rewrites to NamedCExp, so it could be reused by other backends.
The Java backend seems to be doing its own thing. There aren't a lot of comments or documentation in that repository, but I do see evidence that it's doing something interesting in src/Compiler/Jvm/Optimizer.idr:
Pure $ if shouldTrampoline && hasNonSelfTailCall tailCallCategory
then trampolineExpression True inlinedAndTailRecursionMarkedExpr
else inlinedAndTailRecursionMarkedExpr
https://github.com/idris-lang/Idris2/blob/main/src/Compiler/...
One could argue that it's not "full" TCO, but it does cover a lot of use-cases. That rewrites to NamedCExp, so it could be reused by other backends.
The Java backend seems to be doing its own thing. There aren't a lot of comments or documentation in that repository, but I do see evidence that it's doing something interesting in src/Compiler/Jvm/Optimizer.idr: