summaryrefslogtreecommitdiff
path: root/zjit/src
AgeCommit message (Collapse)Author
2025-04-24Make type_of use union-findMax Bernstein
Otherwise we might have stale types floating around Notes: Merged: https://github.com/ruby/ruby/pull/13162
2025-04-24Make PatchPoint(CalleeModifiedLocals) implicitMax Bernstein
We don't have a good model for modeling weakref-like instruction dependency behavior and I don't think we should add it just for this. Notes: Merged: https://github.com/ruby/ruby/pull/13162
2025-04-24Strength reduce sends on Fixnums in the optimizer instead of HIR builderMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13162
2025-04-24Simplify fixnum guarding codeMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13162
2025-04-22ZJIT: Add option to dump LIR (#13139)Max Bernstein
Now we can dump HIR, optimized HIR, LIR, and assembly. Notes: Merged-By: k0kubun <[email protected]>
2025-04-18Change mentions of YJIT to ZJIT (https://github.com/Shopify/zjit/pull/113)Aiden Fox Ivey
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Display Snapshot's FrameState using Display ↵Max Bernstein
(https://github.com/Shopify/zjit/pull/111) This makes the output a little nicer when doing --zjit-dump-hir=all Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add codegen for NewArray instruction (https://github.com/Shopify/zjit/pull/110)Aiden Fox Ivey
* Show failing test * Add second test case * Add empty NewArray setup * Update opt_tests and fix NewArray instantiation * Add code generation for NewArray * Add NewArray ordering test Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Implement JIT-to-JIT calls (https://github.com/Shopify/zjit/pull/109)Takashi Kokubun
* Implement JIT-to-JIT calls * Use a closer dummy address for Arm64 * Revert an obsoleted change * Revert a few more obsoleted changes * Fix outdated comments * Explain PosMarkers for CCall * s/JIT code/machine code/ * Get rid of ParallelMov Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Use GuardType output variableAlan Wu
Helps with readability and threads type info that's there around for longer. Amend test so `GuardType` doesn't DCE'ed. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add codegen support for ArrayDupAiden Fox Ivey
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Mark Guard* as depending on Snapshot in DCEMax Bernstein
We need to keep the Snapshot instruction alive. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Remove any object specialization in CCall optimizationMax Bernstein
We don't want to only guard on the class Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add return_type to FnProperties and CCallMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Strength reduce to `CCall` for sends landing in simple C methodsAlan Wu
A new optimization pass. Also: - Printing for `Insn::CCall` - Wrap `ID` and add convenience method for printing, replacing calls to rb_id2name() Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Insert PatchPoint after each SendMax Bernstein
In case the callee writes to the caller's locals, we need to be able to immediately side-exit because our frame's invariants might have been invalidated. If in the course of optimization we rewrite the Send, we can choose to remove the PatchPoint too---but it's not an error to keep it around. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Disable ZJIT profiling at call-threshold ↵Takashi Kokubun
(https://github.com/Shopify/zjit/pull/99) * Disable ZJIT profiling at call-threshold * Stop referencing ZJIT instructions in codegen Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add --zjit-num-profiles option (https://github.com/Shopify/zjit/pull/98)Takashi Kokubun
* Add --zjit-profile-interval option * Fix min to max * Avoid rewriting instructions for --zjit-call-threshold=1 * Rename the option to --zjit-num-profiles Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add miscellaneous Clippy 'corrections' pt. 2 ↵Aiden Fox Ivey
(https://github.com/Shopify/zjit/pull/95) * Remove immediately deferenced borrow operators source: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow * Remove unnecessary cast as i64 Since Const::CInt64 wraps i64, it is unnecessary to cast to i64. * Remove unnecessary borrow operators * Beautify assign operation syntax * Use .is_null() convenience method * Omit .into() call from u32 to u32 * Use more descriptive std::ptr::null<VALUE>() In lieu of casting a literal as a type, opt to use the convenience type. * Use sized integer literal * Simplify pattern matching to explicit check Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Let --zjit-dump-hir dump the input HIR to codegen ↵Takashi Kokubun
(https://github.com/Shopify/zjit/pull/96) Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Split LHS of CMP if it's an immediate (https://github.com/Shopify/zjit/pull/94)Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Print block param names in asm comment (https://github.com/Shopify/zjit/pull/93)Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Fix opt_neq HIR codegenMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Use find() in frame_state()Max Bernstein
We want to return representatives for the stack and locals. Notes: Merged: https://github.com/ruby/ruby/pull/13131
2025-04-18Add miscellaneous Clippy 'corrections' (https://github.com/Shopify/zjit/pull/92)Aiden Fox Ivey
* Remove redundant statements * Remove .clone() since A64 implements Copy * Remove .clone() since InsnId implements Copy . * Dereference since *const rb_call_data implements Copy * Remove unnecessary return statement * Remove unnecessary braces * Use .is_empty() over length checks * Remove unnecessary conversion handling Since i32 can always fit into i64 (the inner type in Opnd::Imm), the conversion is infallibile. * Use slice notation in lieu of Vec https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg * Simplify match statement Notes: Merged: https://github.com/ruby/ruby/pull/13131
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