On Wed, 23 Jun 2021, Van Snyder via cctalk wrote:
On Wed, 2021-06-23 at 13:36 -0400, Paul Koning via cctalk wrote:
Typical FORTH implementations are neat in that respect, since they
use a threaded code encoding that allows for fast and efficient
switching between threaded code (subroutine calls) and straight
machine code.
I have a vague recollection of a story about a FORTH processor that put
the addresses of the functions to be executed on the return-address
stack (68000?) and then executed a RETURN instruction.
I saw this on the 6502 in Woz's Sweet-16 interpreter.
see e.g.
http://www.6502.org/source/interpreters/sweet16.htm#When_is_an_RTS_really_a_JSR_
I initialiy used this "trick" in my own little bytecode VM but it's
somewhat slower than some other methods, but as usual the trade-off is
code-size vs. speed...
Gordon