Tail calls of funs not optimized?

Björn Gustavsson bjorn@REDACTED
Tue Mar 30 10:14:28 CEST 2021

On Tue, Mar 30, 2021 at 8:46 AM Ondřej Adamovský <oa@REDACTED> wrote:

> Can somebody explain to me why? Or if this still is optimized somehow, then how?

Calls to funs in the tail of a function will be rewritten by the
loader to make the calls tail-recursive.

In OTP 23 or earlier, call erts_debug:df(Mod) to produce a text file
named Mod.dis with the disassembled loaded instructions.

In the upcoming OTP 24 with the JIT enabled, start the runtime system
like this: "erl +asmdump" The generated assembly code for all loaded
modules will be listed in text files with the extension *.asm.

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list