summaryrefslogtreecommitdiff
path: root/zjit/src
AgeCommit message (Collapse)Author
2025-09-25ZJIT: Remove an obsoleted PC guardTakashi Kokubun
A little follow-up on https://github.com/ruby/ruby/pull/14653 Now that we don't generate a PC-less side exit at the entry block, we shouldn't need this guard that was added by https://github.com/ruby/ruby/pull/14643.
2025-09-25ZJIT: Compile ISEQ with optional arguments (#14653)Takashi Kokubun
2025-09-25ZJIT: Remove dead CMEs from `Invariants`Alan Wu
2025-09-25ZJIT: Reference update `Invariant::cme_patch_points`Alan Wu
2025-09-25ZJIT: Forget about dead ISEQs in `Invariants`Alan Wu
Without this, we crash during reference update.
2025-09-25ZJIT: Standardize to `Iterator::map` in `Invariants::update_references`Alan Wu
The old code was doing a manual HashSet/HashMap rebuild, and there isn't a clear performance advantage over `Iterator::map`. So let's use `map` since it looks clearer and it's easier to see that everything was indeed updated. This also adds assertions the old code did not have by way of as_iseq() and as_cme().
2025-09-24ZJIT: Prefer *const u8 for consts (#14652)Takashi Kokubun
2025-09-24ZJIT: Incorporate bb0-prologue and PC check into HIR (#14643)Takashi Kokubun
* ZJIT: Incorporate bb0-prologue and PC check into HIR * Fix an outdated comment * Use shallow clone for LoadPC and EntryPoint * Reproduce the actual HIR graph to pass validation * Fill out param types for jit_entry_block * Add Type::from_cptr * Add a TODO comment about Const::CPtr printing
2025-09-24ZJIT: Add Ruby class objects to HIR type lattice automatically (#14647)Max Bernstein
This: * gets us out of the business of manually writing a bunch of `if`s * gets us more type information * cleans up the code * also adds `types::Numeric`
2025-09-23ZJIT: Allow testing JIT code on zjit-test (#14639)Takashi Kokubun
* ZJIT: Allow testing JIT code on zjit-test * Resurrect TestingAllocator tests
2025-09-23ZJIT: Add stack overflow check to `gen_ccall_variadic` (#14636)Stan Lo
ZJIT: Add stack overflow check to gen_ccall_variadic
2025-09-22ZJIT: Guard receiver class for CCallVariadic (#14630)Takashi Kokubun
2025-09-22ZJIT: Add more type information to DefinedIvar (#14628)Max Bernstein
Add test.
2025-09-22ZJIT: Clean up RangeType (#14627)Max Bernstein
2025-09-22ZJIT: Add polymorphism counters (#14608)Aiden Fox Ivey
* ZJIT: Add polymorphism counters * . * .
2025-09-22ZJIT: Refactor NewRangeFixnum (#14607)André Luiz Tiago Soares
## Context #14409 https://github.com/ruby/ruby/pull/14409#discussion_r2350238583 >You may have noticed that this doesn't produce a New range instruction. For that you probably need to use a local variable (makes it harder for the bytecode compiler to reason about, but the JIT sees through it). If you have time, please rewrite these tests. https://github.com/ruby/ruby/pull/14409#discussion_r2350240389 >There's some code above to do this for you: see arguments_likely_fixnums and coerce something or other ## Changes ### Refactor tests Modify tests force the usage of `NewRangeFixnum` instruction and make tests names more consistent. ### Refactor optimize ranges Didn't found `arguments_likely_fixnums` to be applicable unless we enable profiling for `NewRange` and change the criteria of when the optimization fires. But there were other ways to clean up the code. Simplify the logic and move it to `type_specialize`. Deleted the standalone `optimize_ranges` function.
2025-09-19ZJIT: Fix opt_{hash,ary,str}_{freeze,uminus}Max Bernstein
The stack layout is incompatible with the way we reify the stack for generating fallback SendWithoutBlock: the receiver is an embedded VALUE in the bytecode, not on the stack. Since we don't expect these to be overridden often, instead of fussing about with the stack layout, just hope for the best and PatchPoint/SideExit. Fix https://github.com/Shopify/ruby/issues/760
2025-09-19ZJIT: Expand the list of safe allocatorsMax Bernstein
It's not just the default allocator; other allocators are also leaf.
2025-09-19ZJIT: Wrap commentMax Bernstein
2025-09-19ZJIT: Avoid unnecessary `PopOpnds` and `PushOpnds` codegen (#14614)Stan Lo
* ZJIT: Avoid unnecessary `PopOpnds` codegen If there's no opnds to restore, we don't need to do anything. * ZJIT: Avoid unnecessary sub_into when there's no opnds to allocate
2025-09-19ZJIT: Remove unnecessary empty linesTakashi Kokubun
2025-09-19ZJIT: Fix disasm tests on release build (#14612)Takashi Kokubun
* ZJIT: Fix disasm tests on release build * Rename string() to hexdump()
2025-09-19ZJIT: Simplify NewHash HIR and CodegenStan Lo
We can use `Vec<Opnd>` instead of `Vec<(Opnd, Opnd)>` in NewHash HIR as it's the only usage of such type, which requires special handling.
2025-09-19ZJIT: Count method sends where method lookup failsMax Bernstein
2025-09-19ZJIT: Also count fallback sends to ISEQs we can't direct send toMax Bernstein
Make sure these parameter types are counted in the fallback def_types.
2025-09-19ZJIT: Measure reading/writing locals with level > 0 (#14601)Max Bernstein
ZJIT: Measure writing to locals with level > 0
2025-09-19ZJIT: Test disasm with insta (#14602)Takashi Kokubun
2025-09-18ZJIT: Count writes to the VM frame (#14597)Max Bernstein
This is a) a lot of memory traffic and b) is another good proxy for our ability to strength reduce method calls.
2025-09-18ZJIT: Compile sendforward with dynamic dispatch (#14501)Takashi Kokubun
* ZJIT: Compile sendforward with dynamic dispatch * Reload locals only if it has blockiseq * Add a test case of ... with other args
2025-09-18ZJIT: Support variadic C calls (#14575)Stan Lo
* ZJIT: Support variadic C calls This reduces the `dynamic_send_count` in `liquid-render` by ~21% * ZJIT: Reuse gen_push_frame * ZJIT: Avoid optimizing variadic C call when tracing is enabled
2025-09-18ZJIT: Annotate BasicObject#initialize (#14590)Max Bernstein
It's a no-op and always returns `nil`. Fixes https://github.com/Shopify/ruby/issues/755
2025-09-17ZJIT: Call instance allocation function directlyMax Bernstein
2025-09-17ZJIT: Rename optimize_direct_sends to type_specializeMax Bernstein
2025-09-17ZJIT: Prevent custom allocator in ObjectAllocClassMax Bernstein
2025-09-17ZJIT: Const-fold IsMethodCfuncMax Bernstein
2025-09-17ZJIT: Specialize ObjectAlloc with known class pointerMax Bernstein
This has fewer effects (can be elided!) and will eventually get better codegen, too. Fix https://github.com/Shopify/ruby/issues/752
2025-09-17ZJIT: Split Insn::Const from Insn::GetBlockParamProxy (#14583)Takashi Kokubun
* ZJIT: Split Insn::Const from Insn::GetBlockParamProxy * Print [BlockParamProxy] * Link a TODO comment to a Shopify/ruby issue
2025-09-17ZJIT: Add stat for `def_type` of send fallbacks (#14533)Stan Lo
I thought about creating a new HIR like `SendWithoutBlockFailedToOptimize` that can carry very specific reasons later. But it'll mean adding it to every branch matching `SendWithoutBlock` and may make code unnecessarily complicated. So I take the easier path for now: ``` Top-4 send fallback def_types (100.0% of total 21,375,357): cfunc: 20,164,487 (94.3%) optimized: 1,197,897 ( 5.6%) attrset: 12,953 ( 0.1%) alias: 20 ( 0.0%) ```
2025-09-17ZJIT: Revert documentation indent (#14580)Aiden Fox Ivey
2025-09-16ZJIT: Remove unused countersTakashi Kokubun
Follow-up on https://github.com/ruby/ruby/pull/14565 I meant to push this this as well but it was left un-committed locally.
2025-09-16ZJIT: Debug mechanism to verify leafness for `gen_prepare_call_with_gc` (#14553)André Luiz Tiago Soares
* functional debug mechanism; small refactor * make all tests pass * clean up implementation of debug mechanism for gen_prepare_call_with_gc * revert unnecessary change to gen_object_alloc * make ObjectAlloc non-leaf * fix merge error; reintroduce accidentally deleted counter * remove outdated comment * changes as per review comments * make set_stack_canary more stable * add todo comment to specialize object_alloc * revert whitespace changes * create gen_prepare_leaf_call_with_gc helper * fix spacing
2025-09-16ZJIT: Print local names in FrameState (#14571)Max Bernstein
2025-09-15ZJIT: Revert VM_CALL_ARGS_SPLAT and VM_CALL_KWARG support (#14565)Takashi Kokubun
2025-09-15ZJIT: Support compiling block args (#14537)Takashi Kokubun
2025-09-12ZJIT: Share more code with YJIT in jit.c (#14520)Takashi Kokubun
* ZJIT: Share more code with YJIT in jit.c * Fix ZJIT references to JIT
2025-09-12ZJIT: Let fallbacks handle unknown call types (#14518)Takashi Kokubun
2025-09-12ZJIT: Add specific dynamic send type counters (#14528)Stan Lo
2025-09-11ZJIT: Add support for stats_allocatorAiden Fox Ivey
* Using the shared jit crate, support for a single global_allocator can function * Solves --zjit-mem-size
2025-09-11ZJIT: Check for VM stack overflowAlan Wu
Previously, the included test crashed or turned into an infinite loop due to the missing check.
2025-09-10ZJIT: Revert `self_val` removal and rename it to `recv` (#14504)Stan Lo
* Revert "ZJIT: Removed unused self_val from Send" This reverts commit 13c2f8d5c2b41ec78344ae60f9b5ec1564029418. * Revert "ZJIT: Removed unused self_val from InvokeSuper" This reverts commit 877b625922e0f8de4e7ad801dd0306e69b34d263. * ZJIT: Rename self_val in dispatching HIRs to recv * ZJIT: Remove unnecessary constructor param names