Merge YJIT: an in-process JIT compiler
github.com
github.com
Something that I noticed that might throw others for a loop as well: the changeset is north of 350K, but the actual JIT is only a couple of thousands of lines of C. 90% of the changeset is two torture test files.
Even for Ruby, a basic JIT can be implemented in a few hundred lines of C using a "threaded code" approach.
Real JIT compilers got started this way. Safari JavaScriptCore's JIT used a "context threaded code" approach and was just 4k LOC
https://webkit.org/blog/214/introducing-squirrelfish-extreme...
I like this term
This one gave me a worry. I think it can be addressed, but if it can't this whole effort seems a bit overrated to me.
Sounds like at least part of it will be fixed.
YJIT: Building a New JIT Compiler for CRuby - https://news.ycombinator.com/item?id=28874283 - Oct 2021 (47 comments)
Proposal to Merge YJIT into Ruby - https://news.ycombinator.com/item?id=28691048 - Sept 2021 (77 comments)
YJIT: Building a New JIT Compiler Inside CRuby - https://news.ycombinator.com/item?id=27371977 - June 2021 (1 comment)
https://pointersgonewild.com/2021/06/02/yjit-building-a-new-...
The author of that article (k0kubun) is also one of the reviewers on this PR.
What is the difference between the two JITs?
You can imagine how much it actually helped in the end.
Whatever the native code might help was let down due to the lantency of doing all that work.
... note some other optimizations that they plan to implement that should improve both the JIT and non-JIT performance.
Performance improvements are always welcome in any language.