Tail Calls
Tail calls let a function transfer control to another function as its final action without growing the stack.
(module (func $f (param $n i32) (result i32) (if (result i32) (i32.eqz (local.get $n)) (then (i32.const 0)) (else (return_call $f (i32.sub (local.get $n) (i32.const 1)))))))Instruction Reference
Section titled “Instruction Reference”- Control Flow Instructions —
return_call,return_call_indirect