Also, like this topic , my question is purely academic. How is the promotion of non-tail recursions implemented in the Erlang compiler, what optimizations are used there? I would also be happy to see references to the description of the implementation of these recursions in other PLs.

Closed due to the fact that the issue is too general for participants aleksandr barakin , Alexey Shtanko , dizballanze , a_gura , sepgg Jun 29 '15 at 22:53 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 3
    The only, seemingly, optimization for non-tail recursions is that the stack is truncated when cons comes after the call ( put_list opcode). The history of commits older than R13 was not found (and trim appeared in R12). Here is an example of what the compiler is doing: Optimization - did not penetrate, erlang compiler guts are not for the faint of heart. - drdaeman
  • Interesting. Thanks for the comment. Dig in this direction. - kpdev

0