Principles of Efficient Bytecode Interpretation

We want to create an efficient bytecode interpreter on a tight budget. Luckily, a bytecode interpreter has a readily identifiable inner loop: the code that fetches an instruction, decodes it, and executes its operation. To make the inner loop fast, we’ll limit abstraction, limit calls to C functions, and give the C compiler a chance to put frequently used values in machine registers.

Don’t worry too much about errors and bugs. Focus on clean implementations of the instruction stream, the literal pool, and the register file. As long as you avoid fancy abstractions, clean code will be efficient, and if something does go wrong, it will be easy to debug.