If you look at the disassembly, you can see it jumps back within the method, not using up stack:
IN: scratchpad \ numbers-game-loop disassemble 000000010fba0a10: 8905ea251aff mov [rip-0xe5da16], eax 000000010fba0a16: 53 push rbx 000000010fba0a17: e906000000 jmp 0x10fba0a22 (numbers-game-loop + 0x12) 000000010fba0a1c: 8905de251aff mov [rip-0xe5da22], eax 000000010fba0a22: 498b06 mov rax, [r14] 000000010fba0a25: 4983c608 add r14, 0x8 000000010fba0a29: 498906 mov [r14], rax 000000010fba0a2c: e8bf000000 call 0x10fba0af0 (guess-prompt) 000000010fba0a31: e86affffff call 0x10fba09a0 (read-number) 000000010fba0a36: e8d544f8ff call 0x10fb24f10 (judge-guess) 000000010fba0a3b: 498b06 mov rax, [r14] 000000010fba0a3e: 4983ee08 sub r14, 0x8 000000010fba0a42: 4883f801 cmp rax, 0x1 *000000010fba0a46: 0f85d0ffffff jnz 0x10fba0a1c (numbers-game-loop + 0xc)* 000000010fba0a4c: 4983ee08 sub r14, 0x8 000000010fba0a50: 8905aa251aff mov [rip-0xe5da56], eax 000000010fba0a56: 5b pop rbx 000000010fba0a57: c3 ret 000000010fba0a58: 0000 add [rax], al 000000010fba0a5a: 0000 add [rax], al 000000010fba0a5c: 0000 add [rax], al 000000010fba0a5e: 0000 add [rax], al On Tue, Sep 15, 2015 at 6:38 AM, Alexander Ilin <ajs...@yandex.ru> wrote: > Hello! > > I'm looking at the source of the numbers-game in (extra/), and I wonder > about the following piece: > > : numbers-game-loop ( actual -- ) > dup guess-prompt read-number judge-guess > [ numbers-game-loop ] [ drop ] if ; > > Is it possible that the recursive call to the numbers-game-loop would > eventually overflow the call stack? > > ---=====--- > Александр > > > ------------------------------------------------------------------------------ > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk >
------------------------------------------------------------------------------
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk