Re: Suggestions on implementing an efficient instruction set simulator in LuaJIT2 (2011)
Summary
An archival discussion where LuaJIT author Mike Pall explains why efficient interpreter loops are hard for C compilers and outlines optimization strategies. It covers the drawbacks of diamond-shaped control-flow, the benefits of direct-threaded or computed-goto styles, register allocation challenges, and moving slow paths out of hot loops. The piece emphasizes that interpreters require different optimization heuristics than typical application code and that modern compilers may not yield optimal results.