The state of the art as I understand it (but maybe you’ve figured out something faster?) is threaded interpreters. I suggest looking at Forth implementations, which is where I think most interpreter innovation has happened.
The state of the art as I understand it (but maybe you’ve figured out something faster?) is threaded interpreters. I suggest looking at Forth implementations, which is where I think most interpreter innovation has happened.
Fortunately the Forth community write about their techniques, so you don't have to just eyeball gforth's source-code. A handful of links for those interested:
https://www.complang.tuwien.ac.at/papers/
https://github.com/ForthPapersMirror/Papers
https://www.complang.tuwien.ac.at/projects/forth.html
https://www.complang.tuwien.ac.at/anton/euroforth/
http://soton.mpeforth.com/flag/jfar/vol7.html
http://soton.mpeforth.com/flag/fd/
// classical computed goto
goto *x[y[z]]
// MiniVM precomputed goto
goto *a[z]
This optimization makes MiniVM a tad faster than raw computed gotos, because it's essentially threaded code with some optimizations. He can probably expand on this; if you want to hear the full really interesting explanation yourself, he's pretty active in the Paka Discord[0].