YJIT: ZJIT: Allow both JITs in the same build

This commit allows building YJIT and ZJIT simultaneously, a "combo
build". Previously, `./configure --enable-yjit --enable-zjit` failed. At
runtime, though, only one of the two can be enabled at a time.

Add a root Cargo workspace that contains both the yjit and zjit crate.
The common Rust build integration mechanisms are factored out into
defs/jit.mk.

Combo YJIT+ZJIT dev builds are supported; if either JIT uses
`--enable-*=dev`, both of them are built in dev mode.

The combo build requires Cargo, but building one JIT at a time with only
rustc in release build remains supported.
This commit is contained in:
Alan Wu 2025-05-07 00:19:36 +09:00
parent b5575a80bc
commit 92b218fbc3
Notes: git 2025-05-14 15:39:18 +00:00
20 changed files with 297 additions and 197 deletions

4
vm.c
View file

@ -452,7 +452,9 @@ jit_compile(rb_execution_context_t *ec)
rb_zjit_compile_iseq(iseq, ec, false);
}
}
#elif USE_YJIT
#endif
#if USE_YJIT
// Increment the ISEQ's call counter and trigger JIT compilation if not compiled
if (body->jit_entry == NULL && rb_yjit_enabled_p) {
body->jit_entry_calls++;