summaryrefslogtreecommitdiff
path: root/zjit
AgeCommit message (Collapse)Author
2025-04-18Improve register alloc and dealloc error messaging ↵Aiden Fox Ivey
(https://github.com/Shopify/zjit/pull/90) Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Fix inconsistent indentationTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Make NewArray DCE-ableMax Bernstein
Initialize with a vector of operands instead of ArraySet instructions. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add dead code elimination passMax Bernstein
Dead code elimination (DCE) is like garbage collection for your HIR graph: it removes instructions that are not referenced by the "root set"---in this case, the instructions marked critical. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Reduce the number of Snapshots emittedMax Bernstein
Only emit them on-demand. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Make Snapshot own FrameState objectsMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Remove an outdated commentTakashi Kokubun
https://github.com/Shopify/zjit/pull/87#discussion_r2025152210 Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Move get_class_name into crubyMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Remove Option from get_class_name parameterMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Rewrite SendWithoutBlock to SendWithoutBlockDirect when possibleMax Bernstein
In calls to top-level functions, we assume that call targets will not get rewritten, so we can insert a PatchPoint and do the lookup at compile-time. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Compile Param into VReg and ParallelMov ↵Takashi Kokubun
(https://github.com/Shopify/zjit/pull/87) Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Update the VReg comment to imply spillingTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Disassociate InsnOut from Insn indexTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Fix s/Raw/Debug/gMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Print iseq names in HIR dumpsMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add option to dump optimized HIRMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Only map pointers in testsMax Bernstein
We want to otherwise see real pointers in print output. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Default to BasicObject subclass if unknownMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add profiling for opt_send_without_blockAlan Wu
Split out from the CCall changes since we discussed during pairing that this is useful to unblock some other changes. No tests since no one consumes this profiling data yet. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Make disassembly look nicer using InsnPrinterMax Bernstein
This makes the disassembly comments much easier to read because they use the more familiar `v2` rather than `InsnId(2)` and `Fixnum` rather than `Type { bits: ...... }`. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Use expect-test for HIR testsMax Bernstein
This makes it easier to update cascading test failures while still making output reviewable in the PR. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add constant folding pass (https://github.com/Shopify/zjit/pull/74)Max Bernstein
Add a constant folding pass for HIR. This pass uses the types left by `infer_types` to fold away: * `GuardType(val, ty)` where `val` is already `ty` * `FixnumAdd(l, r)` where `l` and `r` are constants * `FixnumLt(l, r)` where `l` and `r` are constants * `FixnumEq(l, r)` where `l` and `r` are constants * `Test(v)`, where `v` is a constant * `IfTrue(v)` and `IfFalse(v)` where `v` is a constant It does this by using the union-find data structure in the IR to avoid a complicated manual find-and-replace process for all the uses. Right now, for branch instructions that it deletes, we remove from the block completely. This is safe only because we have ensured that nothing refers to branch instructions---they produce no values. However, if we want to instead replace them with Nops that get ignored during codegen or removed by a later DCE pass, that works for me as well. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Don't compute predecessors for infer_types ↵Max Bernstein
(https://github.com/Shopify/zjit/pull/78) We don't need this anymore thanks to the push-driven type union for basic block arguments. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Assert that ids are initializedAlan Wu
I've been bit by this a couple times. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18DRY up IDs that have the same content as their nameAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Fix VALUE/isize conversionMax Bernstein
Coming out of VALUE did not work for negative numbers; they came out as huge numbers instead. Add more tests. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Compile IfFalse, IfTrue, and Jump instructions ↵Takashi Kokubun
(https://github.com/Shopify/zjit/pull/72) * Compile IfFalse instruction * Add a TODO comment * Rename *s_len to num_*s * Run only gen_param() against block.params * Add a few more tests * Wrap label indexes with Label * Compile blocks in reverse post-order * Simplify a nested test * s/get_block/block/ * Return a number instead of an iterator * Clarify the allocator uses disjoint sets of registers * Use Display for Block and Insn * Compile IfTrue and Jump * Avoid resolving Param instructions * Always compile Insn::Param as basic block arguments * Remove an obsoleted variable * Change it back to use find * Use find for params too * Use Display more * Add more tests * nested if * if after if * if elsif else * loop after loop * nested loops * if in loop * loop in if Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18HIR printing: Assign stable address to pointers when first seenAlan Wu
This gives output stability while still showing address equality and inequality. This mapping mechanism is only turned on for FunctionPrinter, so implementation of Display and Debug can share the same code but not go through the mapping process. Outside of `cfg!(test)` we don't want and need to stabilize the addresses. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Fix another case of single-arm matchMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Make reverse post-order traversal iterativeMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Refactor push_fixnum_insn! further (https://github.com/Shopify/zjit/pull/70)Takashi Kokubun
* Refactor push_fixnum_insn! further * Take one or zero extra argument Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Use a more noticeable invalid pointerMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Test builtin type inferenceMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Fix type checking for strings, arrays, and hashes in the constant poolMax Bernstein
Prism hides the objects from the GC by setting the objects' class fields to 0, so class_of returns 0 (unexpectedly, at least to me). Instead, use builtin_type. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Print fake/stable addresses in HIR printer in testsMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Convert send (with block) to HIR (https://github.com/Shopify/zjit/pull/67)Max Bernstein
* Convert send (with block) to HIR * Remove newline Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> --------- Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Revert "Pass $state to fallbacks instead of exit_state"Takashi Kokubun
This reverts commit e2eae71d44ced602946d54a083f600848eab79e9. The $state exists for switching Fixnum insn, so guard_two_fixnums and SendWithoutBlock shouldn't need to use $state. The other macro argument pattern doesn't have $state, so it's now inconsistent. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Pass $state to fallbacks instead of exit_stateTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Resurrect icache invalidation for arm64 ↵Takashi Kokubun
(https://github.com/Shopify/zjit/pull/68) * Resurrect icache invalidation for arm64 * Get rid of cfg(not(test)) Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Refactor Fixnum operations using macrosTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Move a couple of bindgen targets to ZJIT bindgenTakashi Kokubun
We filed https://github.com/Shopify/zjit/pull/65 and https://github.com/Shopify/zjit/pull/64 concurrently. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Rust tests: Load builtins (core library written in ruby)Alan Wu
Key here is calling rb_call_builtin_inits(), which sticking to public API for robustness is done by calling ruby_options(). Fixes: https://github.com/Shopify/zjit/issues/61 Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Implement dynamic dispatch for opt_send_without_block ↵Takashi Kokubun
(https://github.com/Shopify/zjit/pull/63) * Implement dynamic dispatch for opt_send_without_block * Rename stack methods * Fix typos * More clarification on gen_save_sp() * Update a comment * Update a comment about spills * Rename name to method_name * Test no-arg and 2-arg method calls Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Stop sharing yjit/bindgen with ZJIT (https://github.com/Shopify/zjit/pull/64)Takashi Kokubun
* cp -r yjit/bindgen zjit/ * Rename YJIT variables * Stop mentioning YJIT in zjit.c Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Print Ruby exception in test utilsMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Implement codegen for Test insn (https://github.com/Shopify/zjit/pull/57)Maxime Chevalier-Boisvert
* Implement codegen for Test insn * Update zjit/src/codegen.rs Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> --------- Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Explicitly give function parameters types ↵Max Bernstein
(https://github.com/Shopify/zjit/pull/52) * Explicitly give function parameters types Entrypoint blocks have no predecessors, so they are not otherwise typed. This means we have to explicitly mark them as being Object. * Refactor some tests Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Replace ...User with ...SubclassMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add union and predicates for testing if immediate ↵Max Bernstein
(https://github.com/Shopify/zjit/pull/54) * Add union and predicates for testing if immediate * Add tests * Improve description for Primitive * Add undef to immediates Also partition Any into (Primitive | Value), where Value is (Object | Undef) * Add BasicObject to hierarchy * Rename Value to RubyValue and Primitive to CValue Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Prefix stack operation names with `stack_`Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131