by xvilka · 7y ago · 0 comments
> The Baseline Interpreter sits between the C++ interpreter and the Baseline JIT and has elements from both. It executes all bytecode instructions with a fixed interpreter loop (like the C++ interpreter). In addition, it uses Inline Caches to improve performance and collect type information (like the Baseline JIT).
Including elements [of code] from both would be considerably harder in another language.
If you read closely it appears the interpreter is "generated" - that it, it's not written directly in C++ or anything at all, but is instead an interpreter emitted by the JIT compiler!
> The Baseline Interpreter uses the same frame layout as the Baseline JIT, but we’ve added some interpreter-specific fields to the frame.
> Because the Baseline Interpreter and JIT are so similar, a lot of the code generation code can be shared too. To do this, we added a templated BaselineCodeGen base class with two derived classes: - BaselineCompiler: used by the Baseline JIT to compile a script’s bytecode to machine code. - BaselineInterpreterGenerator: used to generate the Baseline Interpreter code.
[0] https://hacks.mozilla.org/2019/08/the-baseline-interpreter-a...
Does anyone know if servo is supposed to be related to Firefox in some way, or if it is always meant to be independent?