Re:Branch Prediction and the Performance of Interpreters – D...
by ehaliewicz2 on Monday August 10, 2015 @06:28PM
(#10037874)
I think direct threading is usually implemented just by reducing the indirection another level,
e.g.
goto *lp
rather than goto **lp
You could implement an interpreter with generated JMP instructions, which might be called direct-threading, but at least in the forth world, where most jumps are to nested user-defined subroutines, subroutine-threading using JSR instructions is typically used.
There is also one step further - emit the actual jump instructions, making a direct threaded code. It is a bit more complicated and not very portable, but if you want to squeeze all the cycles you can it's still an easy and fast option before resorting to a full-scale compiler.