Commit graph

19 commits

Author SHA1 Message Date
Alan Wu
92b218fbc3 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.
2025-05-15 00:39:03 +09:00
Alan Wu
33909a1c69 YJIT: ZJIT: Share identical glue functions
Working towards having YJIT and ZJIT in the same build, we need to
deduplicate some glue code that would otherwise cause name collision.
Add jit.c for this and build it for YJIT and ZJIT builds. Update bindgen
to look at jit.c; some shuffling of functions in the output, but the set
of functions shouldn't have changed.
2025-05-02 23:47:57 +09:00
Max Bernstein
6052b12de4
ZJIT: Replace GetConstantPath with Const if the IC is not empty (#13183)
* Add rb_zjit_constcache_shareable

* Add rb_zjit_multi_ractor_p

* Replace GetConstantPath with Const if the IC is not empty
2025-04-28 12:10:26 -07:00
Takashi Kokubun
58e3aa0224
ZJIT: Drop trace_zjit_* instructions (#13189) 2025-04-28 09:25:56 -07:00
Takashi Kokubun
8b72e07359 Disable ZJIT profiling at call-threshold (https://github.com/Shopify/zjit/pull/99)
* Disable ZJIT profiling at call-threshold

* Stop referencing ZJIT instructions in codegen
2025-04-18 21:53:01 +09:00
Takashi Kokubun
d488f74dee Resurrect icache invalidation for arm64 (https://github.com/Shopify/zjit/pull/68)
* Resurrect icache invalidation for arm64

* Get rid of cfg(not(test))
2025-04-18 21:53:00 +09:00
Takashi Kokubun
5a35c47c82 Stop sharing yjit/bindgen with ZJIT (https://github.com/Shopify/zjit/pull/64)
* cp -r yjit/bindgen zjit/

* Rename YJIT variables

* Stop mentioning YJIT in zjit.c
2025-04-18 21:53:00 +09:00
Max Bernstein
97f022b5e7 Print Ruby exception in test utils 2025-04-18 21:53:00 +09:00
Takashi Kokubun
33a052486b Assert everything is compiled in test_zjit (https://github.com/Shopify/zjit/pull/40)
* Assert everything is compiled in test_zjit

* Update a comment on rb_zjit_assert_compiles

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>

* Add a comment about assert_compiles

* Actually use pipe_fd

---------

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
2025-04-18 21:52:59 +09:00
Takashi Kokubun
0a543daf15 Add zjit_* instructions to profile the interpreter (https://github.com/Shopify/zjit/pull/16)
* Add zjit_* instructions to profile the interpreter

* Rename FixnumPlus to FixnumAdd

* Update a comment about Invalidate

* Rename Guard to GuardType

* Rename Invalidate to PatchPoint

* Drop unneeded debug!()

* Plan on profiling the types

* Use the output of GuardType as type refined outputs
2025-04-18 21:52:59 +09:00
Takashi Kokubun
562c35a560 Resurrect asm comment support 2025-04-18 21:52:58 +09:00
Takashi Kokubun
6a0748d2c5 Port align_ptr for x86 2025-04-18 21:52:56 +09:00
Alan Wu
14a4edaea6 bindgen works in --enable-zjit=dev mode. 2025-04-18 21:52:56 +09:00
Max Bernstein
bd22748c6b Add rb_insn_name to zjit 2025-04-18 21:52:56 +09:00
Takashi Kokubun
cf2e305d73 Initialize VirtualMem 2025-04-18 21:52:56 +09:00
Alan Wu
1d95139bf6 miniruby --zjit -e nil runs through iseq_to_ssa 2025-04-18 21:52:56 +09:00
Takashi Kokubun
0f9557e9a7 Copy VirtualMem and mmap 2025-04-18 21:52:56 +09:00
Takashi Kokubun
0bb709718b Hook ZJIT compilation 2025-04-18 21:52:56 +09:00
Takashi Kokubun
8ad08f1126 Fix template/Makefile.in 2025-04-18 21:52:55 +09:00