ZJIT removes redundant object loads and stores (railsatscale.com)

by tekknolagi 19 comments 92 points
Read article View on HN

19 comments

[−] mananaysiempre 56d ago
Of all the facets of HN’s title autodestroy, I think removing “How” from titles is the worst one. I believe OP can edit it back in though.

(I passed over this article thinking it was a “look how mysteriously smart the mysteriously smart compiler is” acticle, not a “here’s how the smarts in a compiler work” one.)

[−] claudiug 56d ago
for me is more interesting that Maxime Chevalier-Boisvert left shopify and is doing other stuff, who will carry on with zjit
[−] smj-edison 55d ago
I'm working on an interpreter right now, and I'm considering adding JIT support in the future. Are there other blog posts like this, or deep dives that talk about how to implement and tune a JIT?
[−] hoten 55d ago
I used asmjit to implement JIT compilation. Highly recommend it.

Maybe you'll find the resources I link to in the documentation for my project helpful.

https://github.com/ZQuestClassic/ZQuestClassic/blob/main/doc...

Or perhaps you'd find reviewing my usage of asmjit helpful:

https://github.com/ZQuestClassic/ZQuestClassic/blob/main/src...

My main high-level advice would be to have an extensive set of behavioral tests (lots of scripts with assertions on the output). This helps ensure correctness when you flip on your JIT compilation.

You'll eventually run into hard to diagnose bugs - so be able to conditionally JIT parts of your code (per-function control - or even better, per-basic block) to help narrow down problem areas.

The other debugging trick I did was spit out the full state of the runtime after every instruction, and ensure that the same state is seen after every instruction even w/ JIT enabled.

Good luck!

[−] mchusma 56d ago
curious if zjit will be ready to be default over yjit next ruby release. hope so!
[−] riteshyadav02 56d ago
[dead]
[−] diablevv 55d ago
[flagged]