3 ms·
I'm thinking of something like an interpreter, where each function implements one instruction and it does tail calls to go to the next instruction, instead of h
by skybrian 4y ago
I'm thinking of something like an interpreter, where each function implements one instruction and it does tail calls to go to the next instruction, instead of having a giant switch statement in a loop.
To match the implementation without tail calls, you probably don't want the previous instruction(s) on the stack, but all entry points into the interpreter should probably be on the stack.
- Rusky 4y agoYou can get this without the compiler doing any unrolling, by doing non-tail calls at the points where you enter the interpreter.