Re:JuLox: What I Learned Building a Lox Interpreter in Julia
by erichocean on Sunday June 04, 2023 @03:47PM
(#36188890)
Do you have any pointers to papers/books exploring peephole optimizers? I've read a few paper, but found them underwhelming…
[ Parent
| on HN ]
Re:JuLox: What I Learned Building a Lox Interpreter in Julia
by cdcarter on Sunday June 04, 2023 @07:09PM
(#36190425)
I don't have an academic background, and I'll agree that the majority of books I have picked up have covered the subject very well. It's a pretty common technique though, for assembly and for bytecode, so I've learned by reading implementations. `peephole.c` in CPython is particularly easy to read with a small understanding of the CPython API. It's a very limited implementation, but the idea goes far. Lots of things that you might expect the compiler to optimize in IR can be done directly from the bytecode instead.