Now that the JIT compiler could output raw x86-64 machine instructions, the next step was to optimize the AST tree before emitting code bytes.

If the model generated redundant operations, unused variables, or simple constants, I wanted to eliminate them at compile-time to keep the generated machine code as small and clean as possible.





The...