4

Ruby YJIT Ported to Rust

 2 years ago
source link: https://github.com/ruby/ruby/pull/5826
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

@XrXr XrXr commented 16 hours ago

In December 2021, we opened an issue to solicit feedback regarding the porting of the YJIT codebase from C99 to Rust. There were some reservations, but this project was given the go ahead by Ruby core developers and Matz. Since then, we have successfully completed the port of YJIT to Rust. We are opening this pull request to upstream Rust YJIT, effectively replacing the C version of YJIT.

The new Rust version of YJIT has reached parity with the C version, in that it passes all the CRuby tests, is able to run all of the YJIT benchmarks, and performs similarly to the C version (because it works the same way and largely generates the same machine code). We've even incorporated some design improvements, such as a more fine-grained constant invalidation mechanism which we expect will make a big difference in Ruby on Rails applications.

Because we want to be careful, YJIT is guarded behind a configure option:

./configure -–enable-yjit # Build YJIT in release mode
./configure -–enable-yjit=dev # Build YJIT in dev/debug mode

By default, YJIT does not get compiled and cargo/rustc is not required. If YJIT is built in dev mode, then cargo is used to fetch development dependencies, but when building in release, cargo is not required, only rustc. At the moment YJIT requires Rust 1.60.0 or newer.

The YJIT command-line options remain mostly unchanged, and more details about the build process are documented in doc/yjit/yjit.md.

The CI tests have been updated and do not take any more resources than before.

The development history of the Rust port is available at the following commit for interested parties: Shopify@958c89d

Our hope is that Rust YJIT will be compiled and included as a part of system packages and compiled binaries of the Ruby 3.2 release. We do not anticipate any major problems as Rust is well supported on every platform which YJIT supports, but to make sure that this process works smoothly, we would like to reach out to those who take care of building systems packages before the 3.2 release is shipped and resolve any issues that may come up.


Please feel free to comment or ask questions on this pull request if you have any.

AppVoyer CI checks are currently red on the master branch, so they will be red on this PR as well.

claudiug, nfedyashev, hsbt, Josfemova, wesley7891, rainerborene, just1602, JohnAnon9771, rhymes, shimbaco, and 60 more reacted with thumbs up emoji nvasilevski, krzysiek1507, simi, kddnewton, claudiug, tak1n, hllewelyn, YurySolovyov, egor-khanko, nfedyashev, and 81 more reacted with hooray emoji nfedyashev, benoittgt, coreyja, mjobin-mdsol, nvasilevski, Josfemova, rainerborene, just1602, JohnAnon9771, shimbaco, and 44 more reacted with heart emoji nfedyashev, xfalcox, mjobin-mdsol, nvasilevski, koic, Josfemova, rainerborene, miyucy, JohnAnon9771, shimbaco, and 25 more reacted with rocket emoji thatcher-gaming, postmodern, JohnAnon9771, weihanglo, g13ydson, mateusfdl, Kobzol, claudiug, Stranger6667, ashelangovan, and 7 more reacted with eyes emoji

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK